Skip to main content

HTML Minifier

Minify HTML: remove comments and extra whitespace, shrink inline CSS and JavaScript, see the size saved. Private, in your browser.

HTML

Stays in your browser

Result

The result appears here.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to HTML Beautifier, CSS Minifier or JavaScript Minifier.

Free Online HTML Minifier

Make a page smaller by removing what the browser does not need: comments, extra whitespace and unneeded quotes. It gives developers a quick browser-based way to solve a focused html minifier task before moving the result into a project.

How to use the html minifier

Paste your code in the box, adjust the options if you want, and press Minify. Choose what to remove, then press Minify. Text inside pre and textarea is never touched. Inline style and script blocks can be minified too.

Common mistakes

  • Keep the original file: minified code is not meant to be edited or read.
  • Test the result before you ship it, especially if the code relies on function names or comments.
  • Removing optional closing tags and attribute quotes saves bytes but makes the markup harder to read, so keep them off unless size matters most.

Frequently asked questions

Will minifying change how my page looks?
Collapsing whitespace can change spacing between inline elements in rare cases, so the tool keeps one space where words or inline tags meet. Check the page after minifying.
What happens with broken HTML?
HTML is forgiving, so the tool still minifies it and adds a warning that lists tags that were never closed.
Is my HTML uploaded?
No. It runs in your browser.
How do I use this html minifier tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Formatters & Parsers

View all Formatters & Parsers tools →