HTML Beautifier / Minifier
Indent compressed HTML for readability, or minify back to one line. The contents of pre, script, style, and textarea are kept verbatim.
How to Use
Pick "Beautify" (add indentation) or "Minify" (strip whitespace and newlines).
Paste your HTML on the left; the result appears live on the right.
Pick indent width (2, 4, or tab). Copy the result with one click.
FAQ
What about <pre>, <script>, <style> contents?
pre, script, style, and textarea preserve significant whitespace, so their contents are kept verbatim. Only the surrounding indentation is adjusted; minify mode also leaves them untouched.
Are comments handled?
Single-line comments stay on their line; multi-line comments preserve newlines. Minify mode keeps comments — there's no "strip comments" toggle (use a dedicated tool if needed).
Does it handle malformed HTML?
It's a simple tokenizer-based formatter. It will still output something for missing closers or wrong nesting, but indent depth may drift. For strict validation use the W3C Validator.
Can it format CSS or JS?
No — HTML only. Use dedicated CSS/JS formatters. Inside HTML, <style>/<script> blocks have their outer indent adjusted but inner code is preserved.
Is anything sent to a server?
No. All conversion runs in your browser; nothing leaves the page.