HTML Minifier
Paste your HTML and shrink it instantly โ comments gone, whitespace collapsed, all in your browser.
๐ How it works & FAQWhat HTML minifying does
Source HTML is written for humans โ indentation, blank lines, and comments make it easy to read but add bytes that browsers ignore. Minifying strips the parts that do not affect rendering: HTML comments, the whitespace between tags, and long runs of spaces, tabs, and newlines. The result is byte-for-byte smaller markup that renders identically but downloads faster, which helps page speed and Core Web Vitals.
This tool works entirely in your browser with plain JavaScript string processing. Nothing is uploaded to a server, so you can safely paste private or unreleased markup. It also protects the contents of <pre>, <textarea>, <script>, and <style> blocks so their exact whitespace is preserved, and it keeps IE conditional comments (<!--[if ...]>) intact.
How to use it
- Paste or type your HTML into the top box.
- Click Minify (it also updates as you type).
- Read the badge to see the original size, the minified size, and the percent saved.
- Click Copy result to grab the minified HTML for your project.
FAQ
- Will minifying break my page?
- It should not. Only comments and non-significant whitespace are removed, and whitespace inside
<pre>,<textarea>,<script>, and<style>is left untouched. Always test the output in your own build. - Does it minify the inline CSS & JavaScript too?
- No. Script and style contents are preserved as-is so nothing breaks. For deep CSS/JS compression, run a dedicated minifier on those files.
- Is my HTML uploaded anywhere?
- Never. All processing happens locally in your browser, so your markup stays on your device.
- Why is my savings percentage small?
- Already-tidy HTML with few comments and little indentation has less to strip. Heavily commented, deeply indented markup shrinks the most.