Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
HTML Minifier

HTML Minifier

Minify HTML code online to reduce file size. Removes comments, collapses whitespace, strips optional tags, and removes unnecessary quotes.

The HTML Minifier is a free online tool that compresses HTML code to reduce file size. It removes comments, collapses whitespace, strips optional closing tags, and removes unnecessary attribute quotes to produce smaller, faster-loading HTML pages.

  1. Paste or type your HTML code in the input panel on the left.
  2. Adjust options like Remove comments, Collapse whitespace, and Remove optional tags.
  3. Click the Minify button (or press Ctrl+Enter) to minify.
  4. View the compression stats showing original vs minified size.
  5. Click Copy to copy the result, or Download to save as a file.
  • Remove HTML comments (), preserving conditional comments.
  • Collapse unnecessary whitespace between and around tags.
  • Optionally remove optional closing tags (
  • ,

    , , etc.).
  • Remove unnecessary attribute quotes for simple values.
  • Strip default type attributes (type="text/javascript", type="text/css").
  • Preserve content in pre, script, style, and textarea tags.
  • Compression stats showing original size, minified size, and savings.
  • Upload files or paste code directly.
  • 100% client-side — your code never leaves your browser.
Is my code sent to a server?
No. All minification happens locally in your browser. Your code is never uploaded or stored.
Will minification break my HTML?
The minifier preserves content in pre, script, style, and textarea tags. It only removes unnecessary whitespace and comments from the rest of the document.
What are "optional closing tags"?
In HTML5, certain closing tags like </li>, </p>, </td> are optional. Removing them reduces file size without affecting how browsers render the page.
How much file size reduction can I expect?
Typical HTML files see 10–30% size reduction depending on the amount of whitespace and comments in the original code.
Input
Output
Error

Paste code on the left to minify automatically

Original 0 B Minified 0 B
Saved 0%
|
Paste your HTML code and click Minify to compress it.
Use Ctrl+Enter to minify quickly.
Content inside <pre>, <script>, <style>, and <textarea> tags is preserved.
Want to learn more? Read documentation →
1/4
Start typing to search...
Searching...
No results found
Try searching with different keywords