HTML Formatter

Beautify and indent any HTML — minified pages, scraped markup, email templates. Configurable indent width. 100% browser-based. 100% free and private.

How to use

  1. Paste HTML — Drop in minified, scraped, or messy HTML — any size.
  2. Set Indent — Choose 2, 4, or any number of spaces for indentation.
  3. Copy Clean Output — Use the beautified result in your editor, docs, or commit.

The HTML Formatter turns minified or messy HTML into clean, properly indented markup. Perfect for reviewing scraped pages, debugging email templates, or beautifying a build output.

Features

  • Pure JavaScript tokenizer — no external dependencies.
  • Preserves comments, DOCTYPE, and templating syntax as-is.
  • Inline tags (a, span, strong, em) stay on the same line for readability.
  • Configurable indent width.

Privacy

All formatting happens inside your browser. The tool never uploads your markup.

) go on their own line with proper indentation." }} />

When to Format vs Minify

Format during development and code review — readable diffs catch real bugs. Minify before deploying to production — every byte counts for first-paint performance. Most build tools handle minification automatically; formatting is a one-time human-debugging step. Never commit minified HTML to source control." }} />

Limits of Auto-Formatting

attributes, broken heading hierarchy. They make existing structure readable so you can see those issues. Pair with our Heading Structure Checker and Meta Tag Generator for content-level fixes." }} />

More Frequently Asked Questions

Will it change my markup's meaning?

No — formatting only adjusts whitespace. Rendered output is identical.

Does it fix invalid HTML?

It will flag issues, but it does not silently auto-correct (which would risk hiding bugs).

What about embedded <script> and <style>?

Indented as a block; internal JS/CSS formatting is best done with dedicated formatters.

Can I choose tabs or spaces?

Yes — switch between 2-space, 4-space, and tabs.

Is my HTML uploaded?

No. All parsing runs locally.