This tool runs entirely in your browser. Nothing you paste is uploaded.
How you can check →HTML Minifier
Text & DataMinify or beautify HTML in your browser. The whitespace that changes how your page renders survives by default, and a map shows you exactly which runs are safe to collapse before you run it.
The minified HTML appears here.
No network activity while you use this tool Show the numbers
- Requests to any other server
- 0
- Requests since you started typing
- —
- Same-origin requests
- 0
Counted live by your browser's own Performance Timeline — the same data the DevTools Network panel reads. It cannot see what a browser extension does, and it is not meant to replace checking for yourself: here is how, in thirty seconds .
The whitespace that changes how your page looks
This site shipped "The<a>time zone converter</a>" live
on its own homepage, because a build-time HTML compressor discarded the newline between a
text node and the inline element on the next source line. A browser renders that missing
space as two words fused together — a real, visible bug, not a cosmetic one. Most HTML
minifiers collapse all whitespace by default because it looks like the safest, most
thorough option; it is actually the one most likely to break running text. This tool treats
whitespace next to inline-level content — links, spans, buttons, and plain text — as
significant by default, and the whitespace-map toggle on the input pane lets you see exactly
which runs it considers safe before you run anything.
Minified or gzipped — which number matters?
Every HTML minifier reports raw bytes saved, and no browser has ever downloaded raw bytes —
real transport runs through gzip or brotli first. Measured on Bootstrap 5.3.3's CSS, the same
principle applies at a different ratio: minifying alone took 281,046 bytes down to 232,803, a
17.2% raw saving, but gzip narrowed that gap to 7.4% because whitespace compresses extremely
well on its own. HTML is denser with tags and attributes than CSS is with declarations, so its
raw-to-gzip gap is usually smaller, but the same question applies: how much smaller does the
file arrive, not how much smaller is it on disk. The Size tab measures both, in your own
browser with CompressionStream, never estimated.
What this minifier will not do to your file
Two failure modes beyond whitespace are worth knowing about. A <script
type="application/ld+json"> block's type attribute is not redundant
boilerplate the way a plain classic script's is — removing it turns valid structured data
into a syntax error a search engine can no longer parse. This tool's redundant-attribute
removal checks the exact type before touching it (§5.13). And raw-text elements —
<script>, <style>, <pre> and
<textarea> — are parsed as one opaque blob rather than re-tokenized as
markup, so a stray < inside a <script> string never
confuses the parser into thinking a tag started there.
Minification is not obfuscation
Minified HTML is trivially beautified back — this page's own Beautify mode does exactly that — so it provides no secrecy for markup you would rather keep private. It is also not compression: gzip and brotli do the actual byte-shrinking work at transport time, and minifying mostly removes redundancy gzip would otherwise have compressed for you anyway. What minifying genuinely buys you is a smaller file before compression starts, which matters most for pages with heavy inline markup or many repeated attributes.
Common use cases
- Shrinking a static page before shipping it, without fusing words together
- Checking which whitespace runs are safe to collapse before turning the option on
- Minifying inline
<style>blocks alongside the surrounding markup - Confirming a JSON-LD or module script's
typeattribute survived unchanged - Reading a minified third-party page by beautifying it first
Frequently asked questions
- Does minifying HTML break the spacing between words and links?
- Only if you turn on the risky option for it. "The<a>time zone converter</a>" was live on this site's own homepage because a different tool discarded the space between a text node and the next line's inline element (§5.9). This minifier treats whitespace next to inline content — text, links, spans, buttons — as significant by default and never collapses it unless you explicitly opt in, labelled Risky, with the reason stated.
- What is the whitespace map?
- A toggle on the input pane that highlights every whitespace run the minifier is deciding about: green for runs it will collapse safely, amber for runs it is keeping because collapsing them could change what a browser renders. It turns "will this break my layout" from a guess into something you can see before you run the tool.
- Does this minify the CSS and JavaScript inside my HTML too?
- Inline <style> blocks, yes — turn on "Minify inline <style> and CSS attributes" and the same nesting-native CSS engine this site's CSS minifier uses runs on what it finds, with its own savings folded into the attribution table. Inline <script> delegation to a JavaScript engine ships in a later phase; until then, script contents are left exactly as written.
- Is it safe to remove optional end tags and attribute quotes?
- Both are valid HTML5 and invisible to a browser, which is why they default off rather than unsafe: dropping </li> or unquoting class=foo can break naive scrapers, some email clients, and any regex-based tooling reading the markup afterwards. They are Careful, not Risky, and the Balanced preset turns them on.
- Does this upload my HTML anywhere?
- No. Minifying, beautifying and verifying all run in this tab's own JavaScript. The privacy receipt below the tool measures the actual network requests this page made, so the claim is checkable rather than asserted.
- Which minifier does this use?
- A hand-written parser built for this site, tolerant of real-world markup the way a browser is, with raw-text elements like <script>, <style>, <pre> and <textarea> kept as opaque blobs rather than re-tokenized as markup (§5.10). See "The whitespace that changes how your page looks" below for the rule it enforces by construction.