๐Ÿงน

HTML Formatter

Beautify or minify HTML with clean indentation

0 โ†’ 0 characters

Content inside pre, script, style, and textarea tags is left untouched so code samples and inline scripts keep their formatting.

About the HTML Formatter

The HTML Formatter cleans up messy markup in either direction: indented and readable for editing, or compact for production. Content inside pre, script, style, and textarea is preserved exactly.

Minifying removes whitespace that sometimes matters between inline elements, which can change spacing in a rendered page. Compare the page before and after, and keep the readable version in source control.

  • โœ“Indented, tag-per-level output
  • โœ“Minify mode for smaller pages
  • โœ“Inline elements stay on one line

How to use the HTML Formatter

  1. 1

    Paste the HTML into the input box.

  2. 2

    Choose beautify or minify and set the indent.

  3. 3

    Copy the formatted markup.

Frequently asked questions

Will formatting break inline JavaScript?+

No. Script and style blocks are treated as raw content, so their internal whitespace and line breaks are not rewritten.

Can it fix invalid HTML?+

It reformats what you give it but does not repair broken nesting. Use a validator afterwards if the markup came from a template you do not trust.

Save HTML Formatter to your favorites, or keep browsing developer tools.

Browse all 35 developer tools โ†’