HTML Minifier
Strip whitespace and comments from HTML.
How to use the HTML Minifier
- 1 Paste your HTML.
- 2 Choose whether to strip comments.
- 3 Copy the minified markup.
Frequently asked questions
Will minifying break my HTML?
Safe minification only removes redundant whitespace and comments. It preserves content inside <pre>, <textarea> and <script> blocks.
How much smaller will my HTML get?
It depends on how much whitespace and commenting your markup has — typically a 10–30% reduction. Combined with gzip or Brotli compression on the server, the savings add up to faster page loads.
Should I keep an unminified copy?
Yes. Minified HTML is hard to edit, so keep your readable source and minify as a build step or before deploying.
Related tools
Developer
CSS Minifier & Beautifier
Minify or beautify CSS instantly.
Developer
HTML to JSX Converter
Convert HTML markup into React JSX.
Developer
JSON Formatter & Validator
Beautify, minify and validate JSON.
Developer
Markdown to HTML
Convert Markdown to HTML with live preview.
Developer
JavaScript Minifier
Shrink JavaScript with real AST-based minification.