HTML Minifier
Paste readable, indented HTML and get back a compacted version with comments removed and whitespace collapsed, without touching the page's structure.
Overview
Hand-written or templated HTML usually carries indentation and comments that are useful during development but add nothing once the page ships. This tool strips both, shrinking the file for a quick check or a one-off page, without a build tool or bundler in the loop.
Examples & Sample Data
Collapsing whitespace and removing comments
<div> <!-- comment --> <p>Hello</p> </div>
<div><p>Hello</p></div>
How It Works
- Paste your HTML into the input box.
- Click Minify to get a compacted version, ready to copy.
Frequently Asked Questions
No. Minification runs entirely in your browser.
No — minification only removes whitespace and comments that don't affect rendering. It doesn't change the page's structure or content.
Yes. Inline <style> and <script> blocks are compacted too: whitespace and redundant syntax are removed, but variable and function names are left as they are. For a separate stylesheet, use the CSS Minifier.
Related Tools
Explore more high-performance utilities.
More in Developer Tools
- JSON to TypeScript, Zod & Go
- JSON Viewer
- JSON to YAML Converter
- JWT Decoder
- JWT Generator
- MIME Type Lookup
- Number Base Converter
- Password Generator