HTML Formatter & Minifier
Indent messy or minified HTML so it can be read, or strip it back down to one line.
Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.
How to use the html formatter & minifier
- Paste your HTML.
- Choose Format to indent it, or Minify to compress it.
- Copy or download the result.
About this tool
Minified HTML is one long line, and HTML pasted out of a CMS often has indentation that bears no relation to its structure. This re-indents from the tags themselves, so what you see matches how the document actually nests.
Two rules keep the output trustworthy. Content inside <code>pre</code>, <code>textarea</code>, <code>script</code> and <code>style</code> is passed through untouched, because whitespace there is meaningful or belongs to another language. And elements whose content is just text stay on one line — breaking <code><b>word</b></code> across three lines is less readable, not more.
Minifying collapses whitespace between tags and drops comments. It is a text-level pass: nothing is reordered, no attributes are rewritten, and no tags are removed, so the output renders the same as the input.
Common uses
- Reading a minified page you are debugging.
- Tidying an email template before editing it.
- Shrinking a small HTML fragment before embedding it.
Frequently asked questions
- Is this a full HTML parser?
- No. It is an indentation and whitespace pass over the tags. That keeps it fast and predictable, but it will not repair broken markup — badly nested tags stay badly nested.
- Will minifying break my page?
- Whitespace between inline elements can be meaningful, so check the result if your layout depends on spaces between tags. Script and style contents are never altered.
- Is my markup sent anywhere?
- No. Formatting happens in this page on your device.
Related tools
CSS Formatter & Minifier
Format CSS with one declaration per line, or minify it for production.
XML Formatter & Minifier
Indent XML to reveal its structure, or minify it back to a single line.
HTML Entity Encoder & Decoder
Escape text for safe use in HTML, or decode entities back into readable characters.
JSON Formatter
Format, validate and minify JSON with clear error messages that point at the exact position.