HTML Formatter and Minifier

Runs in your browser: nothing is uploaded

Formatting HTML

Paste your markup into the left-hand box and a neatly indented copy appears on the right. Set the indent to 2 spaces, 4 spaces or tabs to suit your project. Minify goes the other way and reduces the markup to its smallest safe form.

Beneath the boxes we tell you if a tag is never closed, or if there is a closing tag with nothing to close. Between them, those two slips explain most broken layouts.

Tidying without changing what visitors see

A careless formatter breaks lines wherever it pleases, and in HTML that can insert or remove a visible space, for instance between a word and the link beside it. We take more care:

  • Text and inline tags are kept together. A sentence that includes <a>, <strong> or <span> stays on a single line, so the gaps between words remain exactly as you wrote them.
  • <pre> and <textarea> are left alone. The spacing inside them is part of the content.
  • Scripts and styles keep their layout. We indent the block as a unit and do not touch the code within.
  • Comments survive formatting. Minifying removes them, except for conditional comments.

Checking your HTML properly

Check HTML runs a full validator and lists every problem with its line and column. Choose one and we take you to it. It picks up repeated IDs, tags closed in the wrong order, elements nested where the standard forbids it, outdated tags such as <center>, and a good deal more.

The checker is html-validate, an open-source library. It is fetched from our own site the first time you press the button, at roughly 130 KB, and from then on it runs on your device like everything else we offer.

Where a formatter earns its keep

  • Reading generated markup. The source of a modern site is a single enormous line. Paste it in and the structure becomes clear.
  • Repairing email templates. Nested tables are much easier to follow with one cell to a line.
  • Sorting out CMS output. Rich-text editors leave a tangle behind them, and formatting shows what is actually there.
  • Cleaner code reviews. With consistent indentation, a diff shows the real change and not a page of whitespace.

Is minifying worth it?

A little. It strips spaces, line breaks and comments, but gzip or Brotli on your server already squeezes most of those out, so the difference in what is actually sent is modest. Do it as part of a build, by all means. Do not do it by hand to a file you still have to maintain; keep the readable copy as your source.

Your markup stays put

Intranet pages, unreleased templates and customer emails all end up in formatters. Ours runs in your browser, so nothing is sent anywhere.

Last reviewed 15 November 2026.