HTML Minifier and Beautifier
Minify HTML safely for faster pages or beautify it into clean, indented code – then check it for missing titles, alt text, heading problems and unclosed tags.
- Safe minify options
- Beautifier
- SEO and tag checks
- Runs in your browser
Your minified HTML appears here.
Processed in your browser – your code is never uploaded. Press Ctrl+Enter in the input to copy the result.
Insights
Add some HTML to see its structure and checks.
SEO and accessibility
Tag problems
Heading outline
Most used tags
How to minify HTML
- Add your HTMLPaste HTML into the left box, open an .html file or drop one onto the box. Press Sample to try it first.
- Minify or beautifyMinify removes comments and extra spaces for a smaller file; Beautify indents the code so it’s easy to read. Choose exactly what minify changes.
- Copy and checkCopy or download the result, then look at Insights for missing titles, alt text, heading problems and unclosed tags.
What each minify option changes
| Option | Before | After |
|---|---|---|
| Remove comments | <!-- nav --><nav> | <nav> |
| Collapse whitespace | Hello world | Hello world |
| Whitespace between tags | </li> <li> | </li><li> |
| Boolean attributes | disabled="disabled" | disabled |
| Default attributes | <script type="text/javascript"> | <script> |
| Attribute quotes | class="hero" | class=hero |
Minify on your server too
For a live website, minify HTML as part of your build (for example with your framework’s production build) and enable gzip or Brotli compression on the server. Use this tool for one-off pages, email templates, snippets and to check what a minifier would change.
Frequently asked questions
Is minified HTML safe to use?
Yes, with the default options. The minifier only removes comments and whitespace that browsers ignore, and never touches the content of <pre>, <textarea> or <script>. Options like removing attribute quotes are off by default because some tools that read your HTML expect quotes.
How much smaller will my HTML get?
Typically 10–25% for hand-written pages, more if they contain lots of comments and indentation. Servers usually compress HTML with gzip or Brotli too, so the saving over the network is smaller – but minifying still helps, and makes the page parse slightly faster.
Why does “Remove whitespace between tags” matter?
Spaces between block elements such as <div> and <p> don’t affect the page, so removing them saves bytes. Spaces next to inline elements such as <a>, <span> or <strong> can be visible, so the minifier keeps a single space there.
Does it minify JavaScript too?
No – inline scripts are kept exactly as written, because safely shortening JavaScript needs a full JavaScript parser. Inline CSS in <style> blocks and style attributes can be minified.
What does the beautifier do?
It puts each block element on its own line with consistent indentation, keeps inline elements like links and bold text in the flow of the sentence, and leaves <pre> and <textarea> content untouched.
What do the Insights checks look for?
On full pages: a title, meta description, lang attribute, viewport and charset. On any HTML: one h1, heading levels that don’t skip, images without alt text, target="_blank" links without rel="noopener", and tags that are never closed or closed in the wrong order.
Is my code uploaded?
No. Everything happens in your browser – your HTML never leaves your device.
How large a file can I use?
Up to 5 MB. Syntax highlighting turns off for very large outputs to keep the page fast.
Related tools
Last updated: