FlipMyFormat

HTML Minifier

Compress HTML without breaking it — pre, textarea, script and style blocks are preserved byte-for-byte, conditional comments survive, and you control every optimisation. Instant and private.

100% Free Preserves <pre> Keeps conditional comments Per-option control Data never sent

Your markup is processed on your device and never sent to any server.

People Also Use

Everything This Tool Does

Aggressive where it's safe, careful where it matters.

Preserves pre & textarea

Whitespace-sensitive blocks are extracted before minification and restored untouched.

Script & style safe

Inline JavaScript and CSS blocks are protected, so minification can't break your code.

Comment removal

Strips developer comments from the markup to cut dead weight.

Conditional comment option

Legacy IE conditional comments can be kept, since removing them changes behaviour.

Whitespace collapse

Runs of spaces, tabs and line breaks collapse to a single space.

Trim between tags

Removes the whitespace between adjacent tags — often the biggest single saving.

Drop empty attributes

Attributes with an empty value, like class="", are removed entirely.

Live saving readout

Original size, minified size, percentage saved and a visual bar, updated as you type.

Per-option control

Toggle each optimisation individually rather than accepting an all-or-nothing preset.

Fully private

Everything runs in your browser — your markup never leaves your device.

What Is and Isn't Touched

HTML minification is only safe when it respects context.

ContentTreatment
<pre> and <textarea>Preserved exactly — whitespace is meaningful there
<script> and <style>Left untouched so code and CSS aren't corrupted
Conditional commentsKept by default, since removing them changes rendering
Ordinary commentsRemoved when the option is on
Whitespace between tagsCollapsed or removed, depending on your options
Empty attributesRemoved when the option is on

Inline elements can be whitespace-sensitive too, so always check the rendered page after minifying.

Preserves

pre & script

Comments

Optional

Conditionals

Kept

Attributes

Empty dropped

Stats

Live saving

Privacy

Never sent

FlipMyFormat vs Other HTML Minifiers

An honest look at how this free tool compares.

FeatureFlipMyFormatOthers
Markup never sent to a serverOften no
Preserves pre & textareaLimited
Script & style untouchedLimited
Conditional comment optionRare
Per-option togglesRare
Live saving percentageLimited
No signup / ads-free

How to Minify HTML

HTML is the first thing a browser downloads, so trimming it shortens the wait before anything else can start. The catch is that HTML minification is easy to get wrong: whitespace is meaningful in some places and irrelevant in others, and a tool that treats the whole document uniformly will happily destroy a code sample or corrupt inline JavaScript. This minifier handles that properly. Before touching anything, it extracts every pre, textarea, script and style block and sets them aside, restoring them byte-for-byte at the end — so formatted code samples keep their indentation and your inline scripts stay valid. Ordinary comments are stripped, but legacy conditional comments are kept by default because removing them genuinely changes how older browsers render the page. Each optimisation is an individual toggle rather than a single aggressive preset, so if trimming between tags causes a spacing issue in your layout you can turn just that off and keep the rest. A live readout shows the original size, minified size and percentage saved with a progress bar, updating as you adjust options. Everything runs in your browser.

1

Paste your HTML

Drop in a page or fragment; it's processed locally.

2

Choose optimisations

Toggle comments, whitespace, tag trimming and empty attributes.

3

Copy or download

Take the minified markup or save it as an .html file.

Why Minify HTML?

First byte to first paint

The HTML document is downloaded before the browser even knows which CSS and scripts it needs. Trimming it shortens that first round trip, which shows up directly in Core Web Vitals.

Where the savings come from

Indentation and the whitespace between tags usually dominate a hand-written page. Comments add more. None of it affects rendering, so it's pure overhead on every single request.

Common Use Cases

Static site pages

Minify pages before uploading when there's no build pipeline.

Email templates

Shrink HTML emails, where size limits and clipping are real.

Landing pages

Cut bytes on a page where every millisecond of load time matters.

CMS templates

Compress theme markup before deploying it.

Embedded widgets

Minify a snippet others will paste into their pages.

Ad or iframe markup

Reduce a fragment that gets requested many times over.

Check a saving

See how much a page can shrink before wiring up a build step.

Strip comments

Remove internal notes before markup goes public.

Tips & Best Practices

Always check the rendered page

Inline elements can be whitespace-sensitive, so load the minified page and look at spacing before shipping.

Keep the readable source

Minify at deploy time and commit the formatted version, so diffs stay reviewable.

Turn off tag trimming if spacing breaks

Removing whitespace between inline tags can close a gap your layout relied on — that toggle exists for a reason.

Minify CSS and JS separately

This tool leaves script and style blocks alone by design; use dedicated minifiers for those.

Enable compression too

Brotli or gzip on top of minification gives the smallest transfer size.

Remove comments before publishing

Internal notes in markup are visible to anyone viewing source.

Troubleshooting

Spacing between elements disappeared

Trimming between tags removed a whitespace gap your inline layout depended on. Turn that option off.

My code sample lost its formatting

It shouldn't — pre and textarea blocks are preserved. Check the code isn't in a plain div instead.

My inline script broke

Script blocks are left untouched by this tool. If something changed, the issue is likely elsewhere in the markup.

The conditional comment vanished

Enable the keep-conditional-comments option, which is on by default when comment removal is active.

Frequently Asked Questions

How do I minify HTML for free?

Paste your markup above and the minified version appears instantly with a saving readout. Copy or download it — free, no signup.

Will it break my page?

Whitespace-sensitive blocks are preserved and every optimisation is optional, but always check the rendered page after minifying.

Does it preserve pre and textarea?

Yes. Those blocks are extracted before minification and restored byte-for-byte.

Are script and style blocks touched?

No. Inline JavaScript and CSS are left exactly as written, so nothing can be corrupted.

What are conditional comments?

Legacy comments that target old Internet Explorer versions. Removing them changes rendering, so they're kept by default.

What does trim between tags do?

It removes whitespace between adjacent tags, usually the largest single saving — but it can close intentional gaps between inline elements.

Why remove empty attributes?

An attribute like class="" has no effect but still costs bytes on every request.

How much smaller will my HTML get?

Typically 20 to 40 percent for hand-written markup. The live readout shows your exact saving.

Should I use gzip as well?

Yes. Minification and compression are complementary — minify first, then let the server compress.

Is my markup sent to a server?

No. Everything runs in your browser, so your HTML never leaves your device.

Can I minify just a fragment?

Yes. A partial snippet works exactly like a full document.

Does it remove closing tags?

No. Some minifiers drop optional closing tags, but that trades robustness for a few bytes, so this tool keeps them.

Does it minify inline CSS?

No. Style blocks are preserved intact — use our CSS minifier for those separately.

Can I download the result?

Yes. Save it as an .html file, or copy it to your clipboard.

Does it validate my HTML?

No. It compresses rather than validates, so malformed markup stays malformed.

Does it work offline?

Once the page has loaded it runs entirely in your browser, so it keeps working without a connection.

Does it work on phones?

Yes, in any modern browser on Windows, Mac, Android or iPhone with nothing to install.

Is this tool really free?

Completely free, forever — no account, no ads and no premium wall.

100% free · No signup · Processed in your browser · Data never sent

Last updated: August 2026 · FlipMyFormat HTML Minifier
Written and maintained by the FlipMyFormat team · Runs entirely in your browser