HTML Minifier
Use our HTML minifier to reduce size and clean up output. Minify and copy the output in one click for faster pages and smaller bundles.
HTML Minifier
SIMILAR TOOLS
What this does
So you want your HTML to download faster, which means making it smaller. This minifies it. Paste your markup, click Convert, and you get a stripped down version with the slack removed, ready for production.
How to use it
- Paste your HTML into the box.
- Click Convert.
- Copy the minified markup with the Copy button.
How it works
This is powered by html-minifier, a well established HTML minifier. It collapses the whitespace between your tags, removes comments, and, usefully, reaches into any inline <style> and <script> blocks to minify the CSS and JavaScript inside them too. It leaves the markup itself intact, keeping your attribute quotes and tags in place, so the page renders exactly as before. It all runs in the browser, so your markup is not uploaded to a server.
Why smaller HTML matters
Every byte your HTML carries is a byte the browser has to download before it can show the page, so trimming the file is a small, easy win for performance, especially on pages served to a lot of people. The comments and generous spacing that make your markup pleasant to write do nothing for the visitor, and this clears them out.
Because it also minifies the CSS and JavaScript you have written inline, a page with a chunk of embedded styles or a script tag can shrink more than you might expect. Keep your formatted version for editing, and run this when you are preparing to deploy.
Questions people ask
Does it change how my page looks or behaves?
No. It removes comments and whitespace and minifies inline code, while leaving the markup and its behaviour intact, so the page renders the same.
Does it touch my inline CSS and JavaScript?
Yes. It minifies the contents of inline <style> and <script> blocks as well, which helps shrink the file a little further.
Will it remove my attribute quotes or tags?
No. It keeps the quotes and tags in place. It focuses on whitespace, comments, and inline code rather than rewriting your markup.
Is my markup sent anywhere?
No. The minifying happens in your browser, so the HTML stays with you.
References
- kangax. html-minifier: JavaScript-based HTML compressor and minifier. https://github.com/kangax/html-minifier
- MDN Web Docs. HTML: HyperText Markup Language. https://developer.mozilla.org/en-US/docs/Web/HTML
Sugam Baskota is a senior software engineer and Computer Science graduate from UT Arlington, with interests in user scripts, browser extensions, developer tooling, and productivity systems. He spends time building practical utilities and extensions in the kinds of workflows Eon is designed to simplify. At Eon Tools, he reviews useful, password, and developer tools.