HTML Prettifier
Format a chunk of HTML into nicely indented, readable markup without altering tag names, attributes, or text content. Inline elements without figurative whitespace are kept on one line when they fit, and long opening tags have their attributes unbundled vertically. Comments, CDATA, and <pre> content are never re-indented, so meaningful whitespace is preserved. Runs entirely in the browser on your device.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
Reindenting markup without rewriting it
Paste a chunk of HTML and the prettifier tokenizes it, builds a tree and re-emits it with one tag per line at the indent you pick. Tag names, attribute order, quoted values and character references are copied verbatim; only the whitespace between tokens is rewritten. Short inline runs that fit stay together on one line, while an opening tag longer than the wrap threshold has its attributes split one per line.
Regions it deliberately leaves alone
Content inside pre, textarea, script, style and xmp is copied exactly, because reindenting it would change what the page actually renders. XML comments keep their original indentation unless you switch on “Re-indent comments”, which is off by default for the same reason.
Choosing indent width and wrap point
“Indent width (spaces)” takes 0–8, and “Use tabs for indent” replaces the indent unit entirely; an indent of 0 gives flush-left tags with line breaks but no nesting. “Max width before attributes wrap”, from 40 to 200 columns, decides when a long opening tag is unbundled vertically onto its own attribute lines.
Malformed markup fails softly
This is a formatter rather than a validating parser: unclosed tags, stray brackets and unknown elements are normalized conservatively and never throw, and input beyond two million characters is refused. Nothing is sent anywhere, so production HTML you would not hand to an online service still stays on your device.
Questions
Is the output semantically identical to the input?
Yes. The formatter only changes whitespace between tokens (and never inside a <pre> element). Tag names, attributes, quoted values, comments and character references are copied as-is.
Can it parse HTML perfectly?
No parser handles every malformed document. Unknown tags, unmatched brackets and weird inline content are normalized conservatively; the formatter is designed to fail gracefully and never throw for malformed markup.
Does it minify?
No, it does the opposite. There is nothing removed and no attribute reordered. Use it to make inline messy markup human-readable again.
Related tools
See categoryHTML to Plain Text
Strip HTML tags to clean, readable plain text — entities decoded, block layout preserved.
HTML to Markdown
Convert an HTML snippet or page into clean Markdown, on device, no server.
HTML Entity Encode / Decode
Escape text for safe insertion into HTML, or decode named and numeric entities.
Markdown Link Checker
Check Markdown links and anchors: broken fragments, missing references, empty URLs.