Skip to content
OnlineToolStudio

HTML Minifier

runs in your browserno sign-upfree

Minify HTML safely: remove comments and extra whitespace, tidy tags, and compress inline CSS and JavaScript — with the size saved shown. Runs in your browser.

Minifying…

Input603 chars
Output

About this tool

This HTML minifier makes pages smaller without changing how they look: it removes comments and the indentation and line breaks between tags, tidies the spaces inside tags, and minifies inline <style> and <script> code with CSSO and Terser. It is careful where whitespace matters — one space stays between inline elements and words, and <pre> and <textarea> content is kept exactly. Conditional comments are kept, and you see how many bytes you save.

How to use

  1. Paste your HTML into the Input box. It is minified as you type.
  2. Choose whether to remove comments and to minify inline CSS and JavaScript.
  3. Copy the minified HTML or download it as a .min.html file.

FAQ

Can minifying break my page?

Not with these settings. Whitespace is only removed next to block elements (div, p, li, head…), where browsers ignore it; between inline elements a single space stays so words don’t join. <pre>, <textarea> and template scripts are left untouched, and inline code with an error is kept as it was (you get a note).

How much smaller will my HTML get?

Usually 10–30% for hand-written pages, more if they have many comments or a lot of inline CSS and JavaScript. Your server’s gzip or Brotli compression saves even more on top, so use both.

Which comments are kept?

IE conditional comments (<!--[if IE]>) always stay because they contain markup. Comments starting with <!--! are kept when “Keep … comments” is on — use them for licences or notes that must survive. Turn off “Remove comments” to keep them all.

Is my code uploaded?

No. Minification runs in your browser, and your code never leaves your device.

Related tools

All tools