Skip to content

HTML Formatter

Runs in your browser

Indent tangled markup so you can read it, or strip comments and whitespace to ship it. Nothing you paste is uploaded.

Input

Output

Formatting…

How this one works

Beautify puts each block element on its own line and indents children inside their parents, so the structure of a page is visible at a glance. Inline elements such as links and <strong> stay in the flow of their text.

Minify removes comments and collapses the whitespace between tags, which browsers ignore anyway. The contents of <pre>, <textarea>, <script> and <style> are left exactly as they are, because whitespace there does matter.

Questions

Will minifying change how my page looks?
It shouldn’t. Whitespace between tags doesn’t render, and whitespace inside text is collapsed to a single space — exactly what the browser does when it displays it. Preformatted blocks, scripts and styles are left untouched.
Does it minify the CSS and JavaScript inside the page too?
No — inline <style> and <script> contents are preserved as written, so nothing inside them can break. Use the CSS Formatter or JavaScript Formatter to minify those separately.
Is my HTML uploaded anywhere?
No. Formatting runs as JavaScript in your browser tab. Nothing is sent to a server, and nothing is stored after you close the page.

Keyboard shortcuts

Global

  • Show this shortcuts dialogShift?
  • Toggle light / dark themeCtrlShiftL
  • Close dialogsEsc

Formatter & Validator

  • Format JSONCtrlEnter
  • Minify JSONCtrlShiftM
  • Copy outputCtrlShiftC
  • Download output as .jsonCtrlShiftS
  • Clear input and outputCtrlShiftX

Tree Viewer

  • Focus the search box/
  • Expand all nodesCtrlShiftE
  • Collapse all nodesCtrlShiftR

Diff

  • Swap document A and BCtrlShiftS

JSON tools

JSON FormatterPretty-print or minify
JSON ValidatorCheck strict JSON validity
JSON Tree ViewerBrowse JSON as a tree
JSON DiffCompare two documents
JSON Path FinderExplore JSONPath expressions
JSON → CSVFlatten JSON into rows
CSV → JSONTurn rows back into objects

JWT tools

JWT DecoderRead header, payload, claims
JWT VerifierCheck an HMAC signature
JWT Expiry Checkeriat, nbf and exp in local time
JWT GeneratorBuild a signed test token
Base64URL EncoderEncode or decode a segment

Code formatters

SQL FormatterBeautify or minify SQL
HTML FormatterBeautify or minify HTML
CSS FormatterBeautify or minify CSS
JavaScript FormatterBeautify or minify JS
Markdown to HTMLConvert with a live preview

Pages

JSON toolsFormat, validate, compare and convert JSON.
JWT toolsDecode, verify and generate JSON Web Tokens.
Code formattersBeautify and minify SQL, HTML, CSS and JavaScript.
HomePopular tools and categories
All categoriesBrowse tools by category
AboutWhat ToolJar is and why
PrivacyWhat is and is not collected

Theme

Switch to light theme
Switch to dark theme