HTML Minifier with Live Size Savings

Minify HTML in your browser and see exactly how many bytes you save. Safely comp...

SecureFastFree

Updated

Original
0 B
Minified
0 B
Saved
0%
0 B
Input HTML0 B
Minified HTML
0 B
Minified HTML will appear here...

Quick answer

An HTML minifier shrinks a page by removing comments and collapsing whitespace between tags, without changing how it renders. Paste your HTML here and it minifies instantly in your browser, showing the original size, the minified size and the exact bytes and percent saved. It safely preserves pre, textarea, script and style blocks byte for byte, keeps IE conditional comments, protects quoted attribute values, and lets you copy or download the .html.

SSL Secured
256-bit Encryption
Cloud Processing
Mobile Friendly

HTML Minifier Features

Safe Minification - Tokenizer that protects pre, textarea, script, style and attribute values.
Live Size Scoreboard - Original, minified and saved bytes plus percent, updated as you type.
Smart Comment Removal - Strips normal comments, keeps conditional and important ones.
Conservative Mode - Keep a single space between tags for inline-sensitive layouts.
Copy and Download - Copy to clipboard or save a ready-to-use index.min.html file.
Private by Default - Runs entirely in your browser with no uploads.

Why Use HTML Minifier with Live Size Savings?

See the Savings Live

Original size, minified size and the exact bytes plus percent saved update as you paste. No guessing how much smaller your HTML got.

Safe by Design

A tokenizer protects pre, textarea, script and style blocks plus every quoted attribute value, so the minified HTML renders identically to the source.

Keeps Conditional Comments

IE conditional comments like [if IE] survive minification, and so do important comments you mark with an exclamation, while every other comment is removed.

Controls That Match the Job

Toggle remove comments, collapse whitespace and a conservative mode that keeps a single space between tags for inline layouts that need it.

100% In Your Browser

Your HTML never leaves the page. All processing runs client-side in JavaScript, so nothing is uploaded to a server.

Copy or Download .html

One click to copy the result or download it as a ready-to-ship index.min.html file for your production build.

What People Use the HTML Minifier For

Production Builds

Compress your final HTML before shipping so browsers download fewer bytes and pages render sooner.

Core Web Vitals

Smaller HTML cuts the bytes the browser must parse, helping LCP and your PageSpeed and Lighthouse scores.

Email Templates

Shrink HTML email templates to stay under client size limits and load faster in the inbox.

Faster Mobile Loads

Fewer HTML bytes matter most on slow mobile networks where every kilobyte affects load time.

How It Works

1

Paste Your HTML

Drop your markup into the input box, or click Load sample to try it. The minified output and size savings appear instantly.

2

Choose Your Options

Keep the defaults to remove comments and collapse whitespace, or turn on conservative mode to keep a single space between tags for inline elements.

3

Copy or Download

Copy the minified HTML to your clipboard or download it as an index.min.html file, then ship it for faster page loads.

Tips & Best Practices

Keep Your Source Readable

Keep the formatted HTML for development and only minify the output for production, so your code stays easy to edit.

Turn On Conservative Mode for Inline Layouts

If links or spans sit side by side and rely on the space between them, enable conservative mode so that single space is kept.

Minify CSS and JS Separately

This tool never touches script or style content. Compress those with the CSS and JS minifiers first, then minify the HTML.

Frequently Asked Questions

Paste your HTML into the input box on this page. The tool minifies it in your browser instantly, removing comments and collapsing whitespace, then shows the original size, minified size and how much you saved. Click Copy or Download to grab the .html file. Nothing is uploaded to a server.
No. Whitespace inside pre and textarea is significant, and script and style content must not change, so the minifier extracts those four elements first and preserves them byte for byte. Only the structural markup around them is collapsed.
Normal comments are removed by default because they never render. IE conditional comments such as [if IE] are always kept because they carry logic, and you can keep any important comment by starting it with an exclamation mark, written as an opening comment then a bang. Turn off Remove comments to keep them all.
No, minified HTML renders identically. The tool only removes characters the browser ignores: comments and redundant whitespace between tags. If your layout relies on the single space between inline elements, turn on conservative mode to keep one space between tags.
Conservative mode keeps a single space between adjacent tags instead of removing it. That matters for inline elements like links or spans, where the space between them is a real, visible gap. Leave it off for maximum compression on block layouts.
It depends on how much whitespace and how many comments the source has. Well indented pages often shrink by 10 to 40 percent. This tool shows you the real number for your file: the exact bytes and percentage saved appear the moment you paste. Combined with gzip on your server, total savings go much higher.
No, and that is on purpose. Script and style content is preserved exactly so the tool can never corrupt your code. To compress those, run the inline CSS through the CSS minifier and the inline JavaScript through the JS minifier, then minify the HTML here.
No. Everything happens locally in your browser using JavaScript. Your HTML is never sent to or stored on any server, so it stays private even for proprietary markup and email templates.

Related Tools