Skip to content
TabKiwiTabKiwi

HTML Minifier

Shrink HTML by removing comments and extra whitespace while leaving <pre>, scripts and textareas intact.

DeveloperRuns in your browser. Your files never leave this device.
Loading tool…

About this tool

The minifier removes comments, collapses runs of spaces and line breaks, and tidies the whitespace inside tags. It is deliberately careful: content inside <pre>, <textarea> and <script> is copied unchanged, conditional comments are kept, and a single space is left between inline elements so text does not run together. Inline <style> blocks can be minified too. You see the size saved, and nothing is uploaded.

How to use HTML Minifier

  1. Paste your HTML into the left box.
  2. Choose which optimizations to apply.
  3. Check the size saving shown below.
  4. Copy the minified HTML or download it.

Frequently asked questions

Is it safe to remove attribute quotes?

It is valid HTML when the value has no spaces or special characters, and the tool only unquotes such values. It is off by default because some tools that read HTML expect quotes.

Why is my inline JavaScript not minified?

Minifying JavaScript safely needs a full parser. Scripts are left untouched so they keep working; use a build tool for JavaScript minification.

Can it break my page layout?

Whitespace between inline elements is kept as one space, and whitespace is only removed next to block elements such as div and p, where browsers ignore it anyway.

More Developer tools

View all 91 →