Shrink your HTML by removing comments, extra whitespace and blank lines - making pages lighter and faster to load. Paste your markup, choose your options and copy the minified result. 100% in your browser - nothing is uploaded or stored.
π Everything runs in your browser. Your input is never uploaded, logged or stored.
The HTML Minifier reduces the size of your HTML by stripping out comments, collapsing unnecessary whitespace and removing blank lines, all without changing how the page looks or behaves. Smaller HTML downloads faster, which improves page speed and Core Web Vitals - factors that affect both user experience and search rankings.
It is part of the Performance & Code Tools group in our free SEO Toolkit, alongside the CSS Minifier and JavaScript Minifier. To reverse the process and make minified code readable again, use the Code Beautifier, and estimate total weight with the Page Size Calculator, and pull out above-the-fold styles with the Critical CSS Extractor. Everything runs in your browser - your input is never uploaded or stored.
Minify safely with control over what gets removed.
Removes HTML comments while keeping IE conditional comments intact.
Squeezes out extra spaces, tabs and line breaks between tags.
Leaves <pre> and <textarea> content untouched, where spacing matters.
See the byte size before and after, with the percentage saved.
Paste, choose options, copy the smaller file.
Drop in your markup or a full page.
Choose what to remove or preserve.
Compare original and minified sizes.
Use the minified HTML on your site.
The same markup, minified.
<ul> <!-- list --> <li>One</li> <li>Two</li> </ul>
<ul><li>One</li><li>Two</li></ul>
HTML minification is the process of removing characters from your markup that are not needed for the browser to render the page - comments, repeated spaces, tabs and line breaks. The page looks and works exactly the same, but the file is smaller, so it downloads and parses faster. This is a simple, safe performance win that contributes to better page speed and Core Web Vitals. This tool minifies your HTML for you. It is part of the Performance & Code Tools group.
| Item | Why It's Safe to Remove |
|---|---|
| Comments | Notes for developers that browsers ignore |
| Whitespace between tags | Extra spaces and newlines that do not affect layout |
| Blank lines | Empty lines used only for readability |
| Repeated spaces | Multiple spaces collapse to one where allowed |
Smaller files reach the visitor and render sooner.
Lighter pages help your Core Web Vitals scores.
Fewer bytes served means lower hosting and data costs.
Speed gains matter most on slower mobile connections.
For typical markup, no. This tool removes only characters that browsers ignore and preserves the contents of pre and textarea, where whitespace is significant. As with any build step, test the minified output before deploying, especially if your HTML relies on unusual whitespace handling in custom layouts.
Conditional comments that start with the if syntax were historically used to target old versions of Internet Explorer and can still affect rendering. To be safe, the minifier leaves them in place and only removes ordinary comments, so it never strips something that might change behaviour.
This tool is ideal for one-off minification, snippets and quick checks. For a live site, it is best to minify automatically as part of your build process or via a caching and optimisation plugin, so every change is minified without manual steps. Use this tool to understand the gains and to handle ad hoc files.
No. Minification runs locally in your browser with JavaScript. Nothing you paste is uploaded, logged or stored, so the tool is safe for proprietary templates, unpublished pages and confidential client work.
Trim page weight to improve load times.
Shrink HTML emails that have strict size limits.
Minify snippets and components before shipping.
Compact widget and embed markup for distribution.
Use the HTML Minifier with these tools from the SEO Toolkit: shrink stylesheets with the CSS Minifier, compress scripts with the JavaScript Minifier, reformat minified code with the Code Beautifier, estimate total weight with the Page Size Calculator, embed images inline with the Base64 Image Encoder, and build head tags with the Meta Tag Generator.
Anyone who wants lighter, faster web pages.
Everything about minifying HTML.
It reduces the size of your HTML by removing comments, collapsing extra whitespace and stripping blank lines, without changing how the page renders. You paste your markup, choose your options, and copy the smaller, minified output for use on your site.
Yes, completely. There is no cost, no sign-up and no limit on how much HTML you minify. The tool runs entirely in your browser, so there are no server costs and nothing to pay for.
No. Minification only removes characters the browser ignores, such as comments and redundant whitespace. The rendered page looks and behaves the same. The tool also preserves pre and textarea content, where spacing is meaningful, to avoid visible changes.
Yes. Minification happens locally in your browser with JavaScript. Nothing you paste is uploaded, logged or stored, which makes the tool safe for proprietary templates, unpublished pages and confidential client work.
It depends on how much whitespace and how many comments your markup contains. Heavily formatted, comment-rich HTML can shrink noticeably, while already-compact markup saves less. The tool shows the exact before and after byte sizes and the percentage saved.
Conditional comments beginning with the if syntax can affect how some browsers render a page, so removing them might change behaviour. To stay safe, the minifier leaves them in place and removes only ordinary comments.
Yes, when that option is enabled, which it is by default. Whitespace inside pre and textarea is significant and visible to users, so the tool protects those blocks from collapsing and restores them exactly after minifying the rest.
This tool is great for one-off files, snippets and learning. For a live site, automate minification in your build process or via an optimisation plugin so every page is minified consistently without manual work. Use this tool for ad hoc needs and quick checks.
Yes. Removing comments and redundant whitespace does not make valid HTML invalid. The structure and tags are unchanged, so the output remains standards-compliant. Always test your specific output if your markup uses unusual patterns.
Minification is not reversible to your exact original, since the removed whitespace and comments are gone, but you can reformat minified HTML into a readable layout with the Code Beautifier. Keep your original source in version control as the source of truth.
Yes. The minifier is fully responsive, so you can compress HTML from a phone or tablet. Pasting markup, toggling options, viewing the savings and copying the output all work the same as on desktop.
Convert, compress, and resize images in multiple formats - JPG, PNG, WebP, ICO, and more.
Calculate in-hand salary, CTC breakup, tax deductions, and more for Indian employees.
Convert length, weight, temperature, speed, volume, and 200+ measurement units instantly.
Count words, convert case, generate lorem ipsum, find & replace text, and more writing utilities.
Strip comments and whitespace to make your pages lighter and faster in seconds - free, private and instant in your browser.
β‘ Open the Minifier β All Performance Tools