Skip to content
DeveloperRuns in your browser

CSS Minifier

Compress a stylesheet by removing comments and whitespace with this CSS minifier.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the CSS Minifier

Minify CSS online — strip comments, whitespace and unnecessary characters from a stylesheet to reduce its size, and see the byte saving. Runs in your browser, no upload.

A CSS minifier does the one job stylesheets cannot skip: CSS is render-blocking, and the browser will not paint the page until the stylesheet has downloaded and parsed. That makes it the one asset where minification has a direct, measurable effect on how fast a page appears, rather than just on how much bandwidth it uses. When you minify CSS, comments and insignificant whitespace disappear, the cascade is untouched, and first paint arrives sooner.

This free CSS minifier compresses stylesheets in your browser: paste the sheet, press the button, read the before and after byte counts, then copy or download the minified CSS. Selectors, properties and values stay exactly as you wrote them.

What a CSS minifier removes

Comments go first — they are notes for humans and are never part of the cascade. Then the whitespace that carries no meaning: the newlines between rules, the indentation inside a block, and the spaces around braces, semicolons and colons. A declaration written across four lines becomes one, and the whole sheet collapses to a single stream of rules.

What a CSS minifier must never touch

CSS uses whitespace as syntax in a few places, and this is where naive minifiers break stylesheets:

ContextWhy the space matters
div pThe space is the descendant combinator
content: "a b"Whitespace inside a string is literal
url(my file.png)Spaces inside a URL value are significant
a, bKeep the comma; the space beside it is optional

The rule the minifier follows is simple: collapse a run of whitespace to a single space where a space is meaningful, and delete it entirely where it is not. Getting that distinction right is the whole job.

What this tool deliberately does not do

A full CSS optimiser can also shorten hex colours, convert rgb values, strip units from zero lengths, merge duplicate rules and reorder declarations. Those transforms change the text of your CSS and occasionally change behaviour, so they belong in a configurable build step you can test against your real pages. This minifier does the safe, universal part — comments and whitespace — and leaves the rest alone.

Where CSS minification fits

Keep the readable, commented stylesheet in source control and minify during the build, so the file you ship is small and the file you maintain is legible. For a quick one-off — inlining critical CSS into a document head, or shrinking a snippet for an email — minifying by hand here is the fastest route.

How much smaller does minified CSS get?

A readable, commented stylesheet typically shrinks by 20 to 35 percent, and a heavily indented design-system file can save more. Comments are the reliable first win — style guides written as block comments are common in large codebases and are pure overhead in production. Over transport compression the marginal gain narrows, but a minified stylesheet also parses faster, and parsing time sits on the critical path to first paint in a way bandwidth savings do not.

Why stylesheet size still matters

Modern sites ship more CSS than they use — audits routinely find that the majority of rules in a delivered stylesheet match nothing on the page. Minification does not remove unused rules (that is a different, riskier optimisation), but it makes every rule that does ship cheaper. For a stylesheet on the critical path the effect is doubled: fewer bytes to download before rendering can begin, and fewer tokens for the parser to walk before the cascade can be computed. Minified CSS plus transport compression is the standard production setup for exactly this reason.

Minify CSS for critical and inline styles

The classic manual use case is critical CSS: the above-the-fold rules you inline into the document head to eliminate a render-blocking round trip. That block needs to be as small as possible, because it is counted inside the HTML response itself. The second is email styling, where every client imposes its own size ceiling and inline styles bloat fast.

Everyday reasons to minify CSS by hand:

  • Inlining a critical-CSS block into a page head before a launch.
  • Shrinking email styles under a client's size ceiling.
  • Compressing a theme or widget stylesheet pasted into a CMS field with a length limit.
  • Preparing a one-file demo or prototype where a build step would be overkill.

A free CSS minifier with no upload

Proprietary styles, unreleased design tokens and brand variables are exactly the content that should not be pasted into a public form. This CSS minifier runs the entire compression locally — comments out, whitespace collapsed, strings and url() values preserved — and reports the byte saving so you know what you gained. Paste, minify, copy or download: private, instant and free, with the readable original left untouched in your repository.

Step by step

How to use the CSS Minifier

  1. Paste your stylesheet into the input panel.

  2. Press Minify CSS; comments and insignificant whitespace are removed.

  3. Check the before and after byte counts to see the saving.

  4. Copy the compressed CSS or download it as a .css file.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Render-blocking bytes removed

Stylesheets block first paint, so every kilobyte you shave off is time the browser is not waiting. Minification is the cheapest win available on critical CSS.

Safe, structure-preserving pass

Selectors, properties and values are left exactly as written; only comments and whitespace that carry no meaning are removed, so specificity and cascade order never change.

Keeps strings and data URIs intact

Whitespace inside content strings, url() values and base64 data URIs is preserved, which naive find-and-replace minifiers get wrong.

Private and instant

The stylesheet is compressed in your tab, so proprietary styles and unreleased design tokens are never transmitted.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

Does minifying CSS change how the page is styled?

No, provided the minifier is correct. Whitespace around most punctuation is insignificant in CSS, so removing it does not affect which rules apply. The exceptions are inside strings, inside url() values and the single space that separates descendant selectors, all of which must be preserved.

Why does the space in a selector matter?

A space is a combinator. The selector div p means a p inside a div, while divp would be a single unknown element. A correct minifier collapses runs of whitespace to one space where the space is meaningful and removes it entirely where it is not, such as around braces, colons and semicolons.

Are CSS comments removed?

Yes, both the block comments used for notes. They are never rendered, so dropping them is safe and is usually the single biggest saving on a heavily annotated stylesheet.

Does it shorten colours or drop units?

This tool is conservative and does not rewrite values such as colours to their short form or strip units from zero lengths. Those optimisations change the text of your declarations, which is best left to a full build-time optimiser you can configure and test.

How much smaller does CSS get?

Typically 20 to 35 percent for a readable, commented stylesheet, and more if it was heavily indented. As with HTML, transport compression reduces the marginal benefit, but minified plus compressed is still the smallest option.