HTML Prettifier & Minifier
Format, prettify, and minify HTML in your browser. Indent nested tags, remove optional closing tags, strip comments and whitespace. No upload, no size limit.
How it works
- Format parses the HTML into a token stream and re-indents each element based on its depth in the DOM tree. Select 2 or 4 spaces, or tabs, from the dropdown.
- Minify strips all non-essential whitespace between tags, removes comments, and collapses text nodes to single spaces or nothing where safe.
- The byte count comparison shows input vs output size so you can see the compression ratio.
- Runs entirely in the browser — nothing is uploaded or transmitted.
What minification removes
HTML minification targets the markup layer: all unnecessary whitespace between tags, leading and trailing whitespace in text nodes, and HTML comments (`<!-- -->`). It does not touch attribute values, inline CSS, or inline JavaScript — those should be minified separately with the CSS and JS tools.
Format options
The beautifier indents nested tags with your chosen indentation size (2 spaces, 4 spaces, or tabs). Optional closing tags like `</p>`, `</li>`, `</tr>`, and `</td>` are preserved. The output is valid, indented HTML that is easy to read and edit.
Frequently Asked Questions
Does this handle incomplete or malformed HTML?
Does minification remove CSS and JS inside the HTML?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.