Options

Minify HTML

Paste your HTML and get a minified version with whitespace and comments removed to reduce file size and speed up page loads, with the bytes saved (gzip too) shown. HTML is read as tags and text so attribute values and inline spacing are never changed.

The whole process is client-side — nothing is uploaded and there's no account — so you can minify assets privately and instantly, drop several files for a ZIP, and compare input and output in Code Compare to check nothing changed.

Need another language or mode? See all formatters and minifiers.

HTML Minifier — frequently asked questions

How do I minify HTML?
Paste your HTML into the left panel and the minified result appears on the right instantly. Copy it or download it as a file.
How is the HTML minified?
The page is read as tags, text and comments, never as one string: attribute values are never touched, the space between inline elements (a <b> next to an <i>) is kept, only the whitespace beside block-level elements is removed, and pre, textarea, SVG text and anything with white-space: pre are kept exactly. Comments go unless they are conditional (or you keep them), and inline <style> and <script> are minified too. Rendering doesn't change.
Is my code uploaded anywhere?
No. Formatting and minifying run entirely in your browser with JavaScript — your code never leaves your device. It's free with no sign-up.

Spotted a bug or have a suggestion?

Found something broken, have an idea, or just want to say thanks about any of our tools? Every message reaches a real person.