Format messy HTML or shrink it
CMS paste arrives with random indentation. Beautify it so you can see the structure. Minify a fragment when you care about bytes in an email or a static include.
This is not a website builder and not a visual renderer. For language rules see MDN HTML.
Whitespace that you must not collapse
<pre>, <textarea>, and <script> can break if you crush every newline. Preserve pre/script/textarea keeps those fragments out of the minifier. Turn it off only when you know the snippet has no significant whitespace.
Keep comments if the fragment still needs a license or an IE conditional.
Formatter vs Markdown converter
Formatting HTML does not turn it into Markdown. If you are moving a CMS page into a docs repo, use the HTML to Markdown Converter. If you are publishing Markdown, use Markdown to HTML Converter.
Common use cases
- Indent a pasted CMS card
- Shrink an email fragment
- Clean a static include before a review
How to use
- Paste HTML.
- Beautify or Minify.
- Copy or download
.html.
Privacy
Processing stays in the browser.
Frequently Asked Questions
Is this an HTML validator?
No. It formats or minifies. Invalid markup may still come back looking tidy. Check semantics in your own linter or in MDN HTML docs.
How is this different from the Markdown converters?
Those change the language. This keeps HTML as HTML. Use Markdown to HTML or HTML to Markdown when you are migrating content, not when you are indenting a snippet.
Will minify break my pre, script, or textarea blocks?
Leave Preserve pre/script/textarea on. Those fragments are skipped so indented code samples and inline scripts keep their internal whitespace.
Does it rewrite CSS or JavaScript inside the page?
No. minifyCSS and minifyJS are off on purpose.
Is the HTML uploaded?
No. Prettier and html-minifier-terser run in the browser.