Whitespace collapsing
Runs of spaces, tabs, and newlines are reduced to the minimum that preserves CSS semantics. Spaces between values that need separation (such as box-shadow components) are preserved, while purely cosmetic whitespace is removed.
CSS Minifier strips comments, collapses whitespace, and tightens punctuation in your CSS so style sheets download faster, parse faster, and use less bandwidth without changing how any page looks.
CSS Minifier is a free, browser-based tool that compresses CSS files and snippets by removing comments, collapsing every run of whitespace, and tightening the spacing around braces, colons, semicolons, and combinators. The output is functionally identical to the input — every browser renders the minified version the same as the original — but the byte count drops significantly, which translates to faster First Contentful Paint, lower Cumulative Layout Shift, and less mobile data usage.
CSS Minifier is safe by default: string literals, url() values, and embedded data URIs are preserved verbatim so font references, background images, and inline SVG continue to work. You can toggle comment removal off if your build pipeline relies on CSS comments as licensing notices or as markers that some other tool reads.
Typical users are developers shrinking critical CSS for above-the-fold rendering, designers preparing email-safe stylesheets, and engineers optimising bundle size in a static site export. Because all processing runs locally, your design tokens and proprietary stylesheets never leave the device for the compression pass.
Runs of spaces, tabs, and newlines are reduced to the minimum that preserves CSS semantics. Spaces between values that need separation (such as box-shadow components) are preserved, while purely cosmetic whitespace is removed.
Spaces around braces, colons, semicolons, and combinators (>, +, ~) are removed. Empty rules and trailing semicolons before closing braces are cleaned up for additional savings.
CSS comments are stripped from the output by default. A toggle lets you keep them when licence headers, attribution notices, or build-tool markers must survive.
Quoted strings, url() values, data URIs, and custom property values are passed through verbatim. The minifier never alters a value, only the whitespace around it.
After each run, the tool displays input size, output size, and percentage saved. This makes the savings visible so you can decide whether the optimisation is worth automating in a build step.
All compression happens in your browser. Your CSS is never transmitted, which keeps proprietary design tokens and unreleased stylesheets confidential.
CSS parsers ignore most whitespace and all comments when building the rule list. A space between a property name and its colon, between a value and the next declaration, or after a closing brace serves only humans — the browser would parse the same rules without any of those characters. CSS Minifier removes that overhead while preserving the spaces that genuinely matter, such as the separators inside shorthand values like margin: 8px 16px or background: #fff url("a.png") no-repeat.
Comments are a different category. They add no rendered output but can be load-bearing for tooling, licence compliance, or build pipelines. CSS Minifier removes them by default because most production stylesheets do not need them, but exposes a toggle so the rare case where they matter is supported without manual surgery on the output.
Minifying CSS also pairs well with brotli or gzip transport compression. Minification removes the bytes that compression would otherwise have to handle, and the two techniques stack — minified CSS gzips smaller than verbose CSS, so enabling both gives the smallest delivered payload.
Input
.btn {
color: #fff;
background: #0070f3;
padding: 8px 12px;
}Output
.btn{color:#fff;background:#0070f3;padding:8px 12px}CSS Minifier is great for one-off compression, but production sites benefit from automated minification on every build. Use this tool to evaluate the savings, then move the same logic into PostCSS, Vite, or Next.js so every release benefits without manual work.
Commit the readable version of stylesheets to version control so diffs are reviewable. Minify only as part of the build output, not in the source files developers edit.
If you use third-party CSS that requires attribution in the file, turn off comment removal so licence headers survive. Some open-source libraries require this even for the minified output.
Inline only the smallest possible set of above-the-fold rules in <style>. CSS Minifier helps you cram more critical styling into the same byte budget without sacrificing render quality.
Minification reduces the raw payload, but transport compression delivers further savings. The two combine well — enabling both gives the smallest delivered size and the fastest FCP.
The source may already be compact. Look at the byte summary to confirm savings; if zero, your CSS is already minified.
Turn off "Remove comments" so attribution and licence notices survive the minification pass.
Inline critical CSS needs to fit inside the first packet for fast First Contentful Paint. Minifying lets you cram more rules into the same byte budget.
Several email clients clip messages beyond a certain size. Minifying inline styles is a quick way to keep the whole email visible without restructuring the template.
Comments and notes accumulate over time. CSS Minifier removes them in one pass, so internal commentary never reaches the production payload.
Some bundlers emit verbose CSS by default. Running CSS Minifier over the output is the fastest way to confirm whether further compression is achievable.
Static-site generators often skip minification by default. CSS Minifier provides a quick way to evaluate savings before configuring the build step.
Yes. CSS Minifier only removes whitespace and comments that the parser ignores. Selectors, declarations, values, custom properties, url() references, and string content are preserved exactly, so the minified output renders the same on every standards-compliant browser.
Yes. CSS Minifier does not interpret CSS at the property level, so any valid syntax — including custom properties (--token), :is(), :has(), @container, @supports, and CSS nesting — passes through unchanged in the output.
It depends on the source. Heavily commented and indented CSS can shrink by 30–50 percent. Already-compact CSS may shrink less. The tool reports the exact byte savings after each run so you can judge for yourself.
They are removed by default along with all other comments. Turn off comment removal when your dependencies require licence attribution in the minified file, or strip them with a CSS-in-JS plugin that keeps a "preserve" hint.
No. All compression runs in your browser. Your stylesheets are never uploaded, so proprietary design tokens and internal product themes remain confidential during the operation.
Yes, by running the output through CSS Beautifier on the same site. Round-tripping through both tools is safe as long as the input is valid CSS to start with.
Yes. Gzip and brotli compress repetitive text well, but minification removes the bytes that compression would otherwise need to handle. The two techniques stack, and minifying before compression typically produces the smallest delivered payload.
No. CSS Minifier only removes whitespace and comments. Class names, IDs, and custom properties are preserved exactly so the HTML that references them does not need to change.
CSS Minifier shrinks stylesheets without touching how they render — use it to fit critical CSS into inline budgets, ship lighter email templates, and squeeze extra performance from your existing assets.