Home › Developer Tools › HTML Minifier

HTML Minifier

Paste HTML and get a smaller file that works exactly the same, with the size saving shown.

Open a .html,.htm file or paste below

How to use HTML Minifier

  1. Paste your HTML or open a file.
  2. The minified code appears straight away, with the size before and after.
  3. Copy it or download the file.

What gets removed

  • Whitespace between block elements and repeated spaces in text.
  • Comments (conditional comments are kept).
  • Spaces inside tags, and default type="text/javascript" and type="text/css".
  • Inline <style> and <script> blocks are minified too; JSON-LD is compacted.

Safe for your layout

A single space is kept between inline elements, so “Hello world” still has its space. The contents of <pre>, <textarea> and unknown script types are left exactly as they are.

Why minify

Smaller files download faster, especially on mobile data, which helps page speed scores like Core Web Vitals. Keep your original, readable file for editing and publish the minified copy.

Frequently asked questions

Is my code uploaded?

No. Everything runs in your browser.

Can I undo the minification?

Use the Code Beautifier to make minified code readable again (comments can't be brought back).

Will it break my code?

No. Spacing that affects how text looks is kept, and pre/textarea content is untouched.

Is there a size limit?

No fixed limit; very large files just take a moment longer.

Related tools

More Developer Tools