Format

Minifier

Minify CSS, HTML, and JSON with size savings

CSS input
Minified output
.container{max-width:1200px;margin:0 auto;padding:20px}.button{background:#fb923c;color:white;border-radius:8px}
Original174 B
Minified112 B
Saved62 B · 36%

Strip comments, whitespace, and formatting from CSS, HTML, or JSON to reduce file size. See the exact byte count saved and the percentage reduction.

Why minify

Every byte sent to a user is a byte they pay for in load time. On mobile connections, each kilobyte can cost hundreds of milliseconds before the page even starts to render. Minification strips everything non-functional — whitespace, comments, redundant syntax — and routinely shrinks CSS by 25–40%, HTML by 30–60% (mostly from removing indentation), and JSON by 20–40%. Combined with gzip on the server, the savings compound further.

What this tool does per format

  • CSS — strips /* comments */, collapses whitespace, removes space around { } : ; , and drops final semicolons inside declarations.
  • HTML — removes <!-- comments -->, collapses whitespace between tags and inside text, preserves single spaces in running text.
  • JSON — re-parses and re-stringifies without indentation. This is the safest kind of minification because the output is guaranteed to be semantically identical.

What it will not do

JavaScript is deliberately not supported here. Safe JS minification (renaming variables, eliminating dead code, hoisting) requires a full parser like Terser or esbuild. Naive whitespace removal on JavaScript can break semicolon-less code. For JS, use a build tool.

Minify in your build, not by hand

For production sites, automate minification — every modern bundler (Vite, Webpack, Next.js) does it automatically. This tool is best for one-off tasks: shrinking an inline style, trimming a hand-written snippet before pasting it somewhere with a length limit, or satisfying a "send the minified version" request.

Frequently asked questions

Is the minified output functionally identical?

For JSON, yes — guaranteed. For CSS and HTML, almost always, but edge cases exist: preformatted content (<pre> tags, CSS content properties with significant whitespace) may look different. Test before deploying.

Why is the saved percentage smaller than I expected?

Your source might already be minimal, or the content may be mostly prose rather than structure. Heavily indented and commented files benefit most.