How to format HTML
Paste your markup on the left and the indented version appears on the right. Choose 2 spaces, 4 spaces or tabs to match your project. Minify does the opposite and squeezes the markup into the smallest safe form.
The line under the boxes tells you if we spotted a tag that is never closed, or a closing tag with nothing to close. Those two faults cause most "why is my layout broken?" tickets.
Formatting that does not change how the page looks
Many beautifiers break lines wherever they like. In HTML that can add or remove a visible space, for example between a word and a link. We are careful about it:
- Text and inline tags stay together. A sentence containing
<a>,<strong>or<span>stays on one line, so the spacing between words is exactly what you wrote. <pre>and<textarea>are untouched. Whitespace inside them is content.- Scripts and styles keep their own layout. We re-indent the block as a whole and leave the code inside alone.
- Comments are kept when formatting, and removed when minifying, apart from conditional comments.
Check HTML against the standard
Check HTML runs a full validator and lists each problem with its line and column. Select one to jump straight to it. It catches duplicate IDs, tags closed in the wrong order, elements nested where they are not allowed, deprecated tags such as <center>, and more.
The checker is the open-source html-validate library. It loads from our own site the first time you press the button, about 130 KB, and then runs on your device like everything else here.
When a formatter saves you time
- Reading generated markup. View-source on a modern site is one long line. Paste it in and the structure appears.
- Fixing email templates. Nested tables are far easier to debug when each cell sits on its own line.
- Cleaning up CMS output. Rich-text editors leave tangled markup behind. Formatting it shows what is really there.
- Tidy diffs. Consistent indentation means a code review shows the real change, not whitespace noise.
Should you minify HTML?
It helps a little. Minifying removes spaces, line breaks and comments, but your server's gzip or Brotli compression already shrinks most of that, so the saving on the wire is small. It is worth doing in a build step. It is not worth doing by hand to a file you still need to edit, so keep the readable version as your source.
Nothing is uploaded
Internal pages, unreleased templates and customer emails all pass through formatters. Ours works in your browser, so none of it leaves your device.
Last reviewed November 15, 2026.