Minify HTML to Shrink Page Size
This HTML minifier compresses markup right in your browser to reduce file size. It removes comments, collapses the whitespace between tags, strips optional closing tags, and cleans up redundant attributes — producing smaller, faster-loading pages that render exactly the same. It is built for front-end developers, template authors, and anyone shipping static HTML who wants fewer bytes without adding a build step.
Why Compress HTML
Faster Rendering
Smaller Payloads
No Build Step
How to Minify HTML
Paste or Upload Your HTML
Type or paste your markup into the input panel on the left, or use Upload to load an .html file. Click Sample to try it with example code.
Choose Your Options
Toggle Remove comments, Collapse whitespace, and Remove optional tags to control how aggressively the page is compressed.
Let It Minify
The output updates automatically as you edit. To minify immediately without waiting, press Ctrl + Enter in the editor.
Review & Export
Check the stats bar for original size, minified size, and the percentage saved. Then Copy the result or Download it as an .html file.
Minification Options & Features
Configurable Options
Each option targets a specific source of bloat. Combine them to reach your preferred balance of size and readability.
| Option | What It Does | Default |
|---|---|---|
| Remove comments | Strips <!-- --> comments while keeping conditional comments | On |
| Collapse whitespace | Removes redundant spaces and newlines between and around tags | On |
| Remove optional tags | Drops optional closing tags such as </li>, </p>, </td> | Off |
Smart & Safe by Default
Preserves Sensitive Tags
Content inside <pre>, <script>, <style>, and <textarea> is never touched, so formatting and code stay intact.
Strips Default Attributes
Removes redundant type="text/javascript" and type="text/css" declarations that browsers assume anyway, plus quotes around simple attribute values.
Keeps Conditional Comments
Legacy IE conditional comments (<!--[if ...]-->) are retained even when comment removal is enabled.
Live Compression Stats
View original size, minified size, and the percentage saved after every run, with syntax-highlighted output.
Frequently Asked Questions
Is my code sent to a server?
No. All minification happens locally in your browser. Your HTML is never uploaded, logged, or stored anywhere.
Will minifying break my HTML?
No. Minification only removes characters the browser ignores anyway. Content inside <pre>, <script>, <style>, and <textarea> is preserved, so the page renders exactly the same.
Does minifying HTML improve page speed?
Yes, modestly. Smaller HTML downloads faster and there are fewer bytes for the browser to parse. The effect stacks on top of gzip/Brotli compression, and matters most on slow or mobile connections.
What are "optional closing tags"?
In HTML5, the closing tags for certain elements — such as </li>, </p>, and </td> — are optional. Browsers infer where they belong, so removing them is valid HTML and reduces file size without affecting rendering.
How much file size can I save?
It depends on how much whitespace, indentation, and how many comments the source contains — heavily formatted or commented templates see the biggest gains. The live stats bar shows your exact savings for each run.
Can I unminify HTML?
Minification is one-way: removed comments and whitespace are gone. To make minified HTML readable again, run it through an HTML formatter or beautifier, which re-indents the markup.
Will it minify my inline JavaScript or CSS?
No. Content inside <script> and <style> tags is preserved untouched. To shrink those, run the code through the dedicated JavaScript or CSS minifier tab first.
No comments yet. Be the first to comment!