HTML Formatter
Paste HTML and read it. Each tag goes on its own line with the indentation its nesting deserves — the fastest way to find the div that was never closed.
The code never leaves this page: formatting happens in your browser.
- Free
- Files never leave your device
- No sign-up
- No file limit
How to use
- Paste the HTML into the first box.
- Choose the indent: two spaces, four, or a tab.
- Copy the result, or press «Minify» to squeeze it back down.
Good to know
What is left alone on purpose
Inside pre and textarea, every space and line break is part of the page — reindenting them changes what the visitor sees. Script and style are not markup at all. The formatter carries those blocks across untouched and only shifts them as a whole, so a formatted file still behaves exactly like the original.
Reading nesting instead of guessing it
Void elements such as img, br and input never close, so a formatter that indents after every opening tag drifts deeper and deeper down the page. Here they are recognised and the indentation stays level, which means an unexpected indent is a genuine sign of an unclosed tag rather than an artefact of the tool.
Frequently asked questions
Does it validate my HTML?
No. It formats what you give it and does not change the markup. An unclosed tag will show up as unexpected indentation, but no error list is produced.
Is my code sent to a server?
No. Formatting happens on the page, so internal templates and pages behind a login stay on your machine.
Can it handle a whole page?
Yes, up to about five megabytes of markup. Beyond that the browser struggles with displaying the result rather than with formatting it.
What happens to comments?
They are kept and placed on their own line. Conditional comments are preserved as well, since they carry markup for old browsers.
Related tools
- HTML Minifier Paste HTML and get it back without the whitespace nobody sees. The counter under the box shows…
- CSS Formatter Paste a stylesheet — even one that arrived as a single line — and read it again. Each declarati…
- XML Formatter Machine-generated XML arrives as one enormous line. Paste it here and the structure appears: on…
- JSON Formatter and Validator Paste JSON and get it formatted, validated or minified. The data stays in your browser — nothin…
- CSS Minifier Paste a stylesheet and get it back compressed. The counter under the box shows the size before…
- SQL Formatter Paste a query that arrived from a log or an ORM as a single line, and read it as a query again…