HTML Beautifier/Minifier
Beautify or minify HTML code.
- Runs in your browser
- No signup
How to use HTML Beautifier/Minifier
Paste your HTML
Messy, minified or copied-from-somewhere HTML all works.
Beautify or minify
Set indent size and line wrapping to reformat, or minify to strip whitespace and comments.
Copy the result
See the syntax-highlighted output and how much the size changed, then copy it.
How to beautify or minify HTML
HTML from page builders, CMS exports and email templates is often a single tangled line, which makes it hard to read or debug. HTML Beautifier/Minifier reformats it into clean, indented code, or squeezes it down for production, right in your browser.
Beautify
Beautify re-indents every element so the nesting is obvious, making unclosed tags and misplaced elements easy to spot. You can set the indent size, choose where long lines wrap, and decide whether content inside head and body is indented.
Minify
Minify removes whitespace between tags, drops optional comments and collapses boolean attributes (disabled="disabled" becomes disabled), reducing the bytes a browser has to download. The size stats show exactly how much you saved. Keep a readable copy for editing; minified HTML is meant for delivery, not maintenance.
Good to know
A few things to keep in mind:
- The tool formats HTML but does not validate it against W3C standards, so invalid markup is formatted as-is.
- Whitespace inside pre and textarea elements is significant; check those after minifying.
- For stylesheets use the CSS Minifier, and for converting Markdown use Markdown to HTML.
When to beautify, when to minify
Beautify when you are reading, editing or reviewing markup, for example a template exported from a page builder or an email from a marketing tool. Minify only the final copy you serve to visitors, and keep the readable version as your source.