HTML Formatter and Minifier — Indent and Compact Markup

Developer Tools

Loading tool...

About This Tool

Format HTML with spaces or tabs, or compact whitespace while preserving preformatted text and embedded scripts. Review and copy the source output.

How to Use

  1. Paste HTML, up to 1,000,000 UTF-16 units.
  2. Choose indentation and click Format or Minify.
  3. Review the source output and test the page in context.
  4. Copy the result.

Work with HTML source

Format adds indentation with two spaces, four spaces or tabs. Minify uses conservative whitespace collapsing and retains comments. Preformatted content and embedded script and style text are not minified as JavaScript or CSS. Output remains text in the editor, not a rendered live preview.

Whitespace can matter

HTML parsing is more reliable than replacing every run of spaces, but formatting can still affect whitespace-sensitive layouts or templating syntax. External CSS using white-space rules can make ordinary text spacing significant. Test the complete page and keep the original. This tool is not an HTML sanitizer or an accessibility validator.

Limits

Input is limited to 1,000,000 UTF-16 units. Size counters show UTF-8 bytes, alongside line and element counts. The parser bundle loads from the site at first use. See the shared privacy policy.

Frequently Asked Questions

Does the output execute scripts?
The output is shown as source text, not inserted as a live HTML preview.
Does it also compress JavaScript and CSS?
No. Embedded script and style text are not separately minified.
Will the layout always stay identical?
That is not guaranteed. Test whitespace-sensitive content with the complete stylesheet and page.