HTML Formatter
Paste raw or minified HTML — get a clean, indented document. Or minify for production. All client-side.
- Runs in browser
- No signup
- No tracking
How to use HTML Formatter
Paste HTML into the input pane (or upload a .html file).
Pick indentation: 2, 4, or tab.
Click Format to beautify, or Minify to compress.
Copy or download the result.
When to use it
Cleaning up minified HTML pulled from a network panel.
Inspecting a CMS-generated page without view-source jumble.
Preparing static templates for version control.
Shipping minified HTML to production.
What it fixes
Online formatters that strip your inline scripts or rewrite attribute order.
Tools that break <pre> blocks by re-indenting them.
IDE formatters that won't run on raw paste-buffer text.
About HTML Formatter
HTML formatting normalizes indentation, line breaks, and tag wrapping so a document is readable at a glance. The minifier inverts that — strips comments and whitespace where the parser doesn't need it, shrinking transfer size.
This tool runs js-beautify locally in your browser. Multi-MB documents format in milliseconds, and your markup never touches a server.
References: MDN — HTML elements reference · WHATWG HTML Living Standard
Frequently asked
Is my HTML sent to a server?
No. Formatting happens entirely in your browser via js-beautify. Nothing leaves your device.
Does it preserve <pre> and <code>?
Yes. Whitespace inside <pre> and <code> tags is preserved unchanged.
What about minification?
The minifier strips HTML comments, collapses whitespace between tags, and removes redundant newlines.
Indent options?
2 spaces, 4 spaces, or tabs. Default 2 spaces.