About HTML Formatter
Turn minified or messy HTML into neatly indented, readable markup. Block-level elements such as div, ul and p each go on their own line, while inline runs like “Hello <b>big</b> world” stay together so the text reads naturally. Contents of pre and textarea are never touched, and script and style bodies are kept exactly as written.
How to use HTML Formatter
- Paste your HTML or open an .html file.
- Choose 2 spaces, 4 spaces or a tab for indentation.
- Read the formatted result and any warnings about mismatched tags.
- Copy it or download formatted.html.
Tips and good to know
- Formatting only changes whitespace between elements; it never adds, removes or reorders tags.
- Long lines of inline text are not wrapped, so a very long paragraph stays on one line.
- This is a tidy-up tool, not a validator: it warns about stray or unclosed tags but does not check that your HTML follows the specification.
Why format HTML
Minified or generated HTML is often one long line, which makes it hard to find a broken tag, a missing attribute or the element a style applies to. Formatting adds indentation that mirrors the nesting of elements, so you can see at a glance which tags are inside which. This is especially useful when copying markup from email builders, page builders or a browser's view-source.
Formatting doesn't fix invalid HTML: an unclosed div or a tag in the wrong place stays wrong, although the indentation often makes the mistake obvious. Browsers repair broken markup silently and differently, so it is worth fixing. Be careful with whitespace-sensitive elements such as pre and textarea, and inline elements, where added spaces can show up as visible gaps on the page.
Frequently asked questions
Will formatting change how my page looks?
It should not. Whitespace between inline elements is preserved as a single space, and whitespace-sensitive elements such as pre and textarea are left alone.
Does it format the JavaScript and CSS inside the page?
No. Script and style contents are kept as they are. Use the CSS Formatter for stylesheets.
Is HTML Formatter free?
Yes. HTML Formatter is free: no sign-up, no paid plan, no trial and no limit on how often you use it. It runs in your browser, and ToolzAura is paid for by ads, so every tool stays free.
Are my files uploaded?
No. This tool runs in your browser, so your input stays on your device.