Clean Indentation
Nested tags get consistent, readable indentation so you can follow the structure at a glance.
Clean up messy HTML in your browser. Format it with proper indentation or minify it down to one line, with the contents of script, style, and pre kept intact. Free, no signup, nothing uploaded.
Drop in your HTML, or upload an .html file. The formatted result appears right away.
Choose Format to indent the markup cleanly, or Minify to strip it down to a single compact line. Set the indent size when formatting.
Copy the result or download it as an .html file, ready to drop back into your project.
HTML has a way of turning into one long unreadable line. Markup copied from a page source, output from a builder, or pasted from a minified file all arrive squashed together, with no indentation to show what sits inside what. Reading it, or finding a bug in it, becomes a chore.
This formatter fixes that. It walks the markup tag by tag and rebuilds it with clean, consistent indentation, so the nesting is obvious and the structure is easy to scan. Void tags like img and br are handled correctly, and the contents of script, style, pre, and textarea are left exactly as they are so nothing breaks.
When you need the opposite, switch to minify and the same markup collapses to a single compact line for production. Pick your indent size, paste your HTML, and copy the result. It all runs in the browser, so even private templates stay on your machine.
Nested tags get consistent, readable indentation so you can follow the structure at a glance.
Beautify messy markup, or minify it to one line to cut file size for production.
The contents of script, style, pre, and textarea are preserved, so your JavaScript and CSS are not mangled.
Switch between two spaces, four spaces, or tabs to match your project style.
Type HTML in, paste it, or load an .html file straight from your computer.
Your markup is formatted on your device. Nothing is uploaded, logged, or stored.
More Developer tools you might find useful.
Common questions about formatting HTML.