HTML Formatter

This HTML formatter pretty-prints and minifies markup in the browser with js-beautify. Paste a single-line template, a CMS export, or a component dumped onto one line, then choose Format for indented tags or Minify for a compact string. Options cover indent size (2 or 4 spaces), an optional wrap line length, and whether existing newlines stay in place. Wrap length 0 leaves long attribute lists unbroken; a positive number breaks those lines so reviews stay readable.

Formatting only changes whitespace. It does not close tags, rename classes, or rewrite inline styles. If you need unclosed-tag or duplicate-id checks, use HTML Validator first, then format the fixed source here. HTML Beautifier is the sibling page for deeper attribute wrapping; this page is the faster format-and-minify path.

Nothing is uploaded. The editor treats your HTML as text, so scripts inside the paste do not run on this page. That matters for email templates, admin snippets, and third-party widgets you would rather not execute while cleaning indentation. Download the result as .html or copy it back into your editor when the structure is easy to scan.

Input
Paste or type your content here…
Output
Your result will appear here

Frequently Asked Questions

How is HTML Formatter different from HTML Beautifier?
HTML Formatter is the everyday format-and-minify page. Indent size, wrap length, and preserve-newlines are the controls. HTML Beautifier is the deeper re-indent workflow with extra attribute wrapping. Use Formatter when you want readable markup or a compact one-liner; use Beautifier when a style guide needs finer attribute layout.
Does Format check for unclosed tags?
No. Format rewrites whitespace. It does not lint duplicate ids, missing alt text, or unclosed elements. Open HTML Validator for structural checks, then come back here to pretty-print the corrected source.
Will scripts in my HTML execute while I format?
No. The editor shows source text only. Pasted markup is not inserted into this page as a live document, so script and event-handler content stays inert while you format or minify.
When should wrap line length be 0?
Leave wrap line length at 0 to keep long attribute lists on one line. Set a positive length only when tags such as img or a have so many attributes that a single line is hard to review. Minify ignores that wrap setting and collapses inter-tag whitespace into a compact payload.