Overview
What this tool does
Minify HTML to shrink its file size by removing comments and unnecessary whitespace, or beautify messy and minified HTML with clean indentation. The minify mode shows exactly how many bytes you save. Everything runs in your browser, so your markup is never uploaded.
Smaller, faster
What minifying does
Minifying removes everything a browser doesn't need to render the page:
- HTML comments (except conditional comments)
- Whitespace between tags (line breaks and indentation)
- Runs of multiple spaces collapsed to one
- Leading and trailing whitespace
The page renders identically, but the file is smaller — typically 10-30% — so it downloads faster. Faster pages improve user experience and Core Web Vitals, which can help SEO.
Readable again
What beautifying does
Beautifying is the reverse: it adds line breaks and consistent indentation so HTML structure is easy to read and edit. Use it to clean up minified HTML you need to work with, or to tidy messy markup pasted from a page or an export.
Safe minification
What's preserved
Whitespace-sensitive content is kept
Practical advice
When to minify
- One-off pages or email HTML: minify here before deploying
- Whole sites: let your build tool (Vite, webpack) or CMS minify automatically so your source stays readable
- Always keep an unminified source copy for editing
- Minify after all other processing, as the last step before publishing
Behind the scenes
Privacy and how it runs
Runs in your browser
Common questions
How much smaller does minified HTML get?
Usually 10-30%, depending on how much whitespace and how many comments the source has. Heavily indented, well-commented files shrink the most. The tool shows the exact percentage saved.
Does minifying HTML help SEO?
Indirectly. Smaller HTML loads faster, and page speed is a ranking factor and affects Core Web Vitals. The effect is modest on its own but part of good performance practice.
Will minifying break my JavaScript or CSS?
No. The content inside script and style tags is preserved exactly. To minify the CSS or JS itself, use a dedicated CSS/JS minifier — this tool focuses on the HTML structure around them.
Can I reverse minified HTML?
Yes — switch to beautify mode and paste the minified HTML to get a clean, indented version back. Note that removed comments can't be recovered, since minifying deletes them.
Should I minify by hand?
For a single page or snippet, this tool is ideal. For an entire site, automate it in your build pipeline so you never edit minified files directly and your source stays maintainable.