HTML Minifier
Reduce the size of your HTML pages by removing comments and unnecessary whitespace. Smaller HTML reaches the browser sooner, which speeds up the first render of your page.
Free · No sign-up · Files stay on your device
How to use HTML Minifier
- 1Paste your HTML or open an .html file.
- 2Choose the options you want.
- 3Copy the minified HTML or download it.
Features
- Removes comments (keeps IE conditional comments)
- Collapses whitespace safely
- Minifies inline <style> CSS
- Never touches pre, textarea or script content
- Shows bytes saved
Safe minification
Whitespace between words and inline elements affects how text is displayed, so it is collapsed to a single space rather than removed. Whitespace next to block elements such as div, p and li is removed entirely, because browsers ignore it. Content inside pre, textarea and script tags is never changed.
How much will I save?
Typical hand-written or template-generated HTML shrinks by 10–25%. Pages with lots of indentation and comments save more. Combine minification with gzip or Brotli on your server for the best results.
Frequently asked questions
Will minified HTML look different?
No. Only whitespace that browsers ignore is removed, and remaining runs of spaces are collapsed to one, which is how browsers display them anyway.
Is JavaScript minified?
No. Script content is left exactly as it is, because minifying JavaScript safely needs a full parser.
Should I edit the minified file?
No. Keep your original HTML for editing and minify it when you publish.