CSS Minifier — compress CSS & shrink stylesheets
Paste CSS and get a smaller stylesheet, live: comments and wasted whitespace removed, hex colors shortened, leading zeros and zero-length units trimmed — with the exact byte saving shown before you ship it. Strings, url() data, calc() spacing and keyframe selectors are never touched.
What to remove
License comments (/*! … */) are always kept. Only zero lengths lose their unit (0px → 0) — 0%, 0s and keyframe selectors are never rewritten, and quoted strings and url() contents pass through byte for byte.
Start from an example
One click loads the stylesheet — the minified result and its saving appear immediately.
Your session
Versions from this visit, kept only in this tab's memory — step back and forth, pin the ones you want to keep handy, and restore any of them with one click. Nothing here is stored or sent anywhere.
Recent versions
No versions yet this session — paste CSS or load an example and they will appear here.
Pinned versions
No pinned versions yet — pin one above to keep its minified output handy.
Your tools
Tools you have actually opened this session, plus any you pin as favorites. The lists live in this browser session only.
Recently used
No other tools opened yet this session — tools you visit will appear here.
Favorite tools
No favorites yet — pin a tool below.
All encoding & conversion tools
How to minify CSS online
- Paste your CSS — a full stylesheet or any fragment — into the input box. The minified result and byte counts update live.
- Toggle what to remove: comments, whitespace, long hex colors, leading zeros, and units on zero lengths.
- Check the saving, then copy the result or download it as a .css file. Keep your readable original as the copy you edit.
Worked example
Both stylesheets style the page identically. The banner comment, every indentation space, the doubled hex pairs (#ffffff → #fff), the units on zero margins and the leading zero on 0.95 are gone — and note what survived: the spaces inside 12px 24px and 200ms, because a time always needs its unit.
What each option removes
| Option | Removes | Never removes |
|---|---|---|
| Comments | /* … */ notes and banners | Important comments starting /*! — the license and credit convention |
| Whitespace | Indentation, line breaks, spaces around { } : ; , and combinators, the last ; in a block | The space in and ( in media queries, spaces around + and − in calc(), the descendant space in div :hover |
| Hex colors | Doubled pairs and uppercase: #FFFFFF → #fff, #aabbccdd → #abcd | Hex-looking ID selectors such as #ffffff { } — shortening happens in declaration values only |
| Leading zeros | 0.5 → .5, -0.25em → -.25em | The zero in 10.5 — only a leading zero before the decimal point goes |
| Zero units | Units on zero lengths: 0px, 0em, 0rem → 0 | 0% (a keyframe selector, and required in hsl()), 0s/0ms (times always need a unit), 0deg |
Minify, then compress
Minification and transfer compression do different jobs. Minification deletes bytes outright — comments and indentation are gone before the file leaves the disk. gzip or Brotli then squeezes the patterns that remain. A minified stylesheet is also slightly cheaper for the browser to parse. Run this tool first, then let your server compress the result.
What to do with your minified CSS next
Minified output is a publishing artifact, not a working file. Save it alongside your readable source, spot-check the page in a browser, and minify the page and its scripts too: the HTML Minifier handles the document (including its inline <style> blocks) and the JS Minifier handles JavaScript. The “Send minified CSS to…” bar above carries the current result into each of those tools for you — and a stylesheet those tools send back arrives here ready to minify.
Frequently asked questions
What is CSS minification?
CSS minification removes everything a browser does not need to apply your styles: comments, indentation and line breaks, spaces around punctuation, and needlessly long values such as #ffffff where #fff means the same thing. The selectors, properties and cascade stay identical — only the file gets smaller, so it downloads and parses faster.
Does minified CSS behave exactly the same?
Yes. Minification never renames classes, properties or values, and never reorders rules, so specificity and the cascade are unchanged. This tool is deliberately conservative about the places where whitespace and characters are significant — strings, url() contents, calc() expressions and keyframe selectors pass through untouched. Always keep your readable original as the source you edit, and minify a copy for publishing.
What exactly does this CSS minifier remove?
You choose: /* */ comments (license comments starting /*! are always kept), collapsed whitespace and the final semicolon in each block, long hex colors shortened and lowercased (#FFFFFF becomes #fff), leading zeros on decimals (0.5 becomes .5), and units on zero lengths (0px becomes 0). The stats panel shows the exact byte saving for the options you picked.
Will minifying break my calc() expressions or media queries?
No. The spaces around + and − inside calc() are significant CSS, so this minifier only collapses them to a single space and never deletes them. The same care applies to media queries, where 'and (' must keep its space, and to keyframe selectors such as 0% and 100%, which are never rewritten. Quoted strings and url() contents — including data URIs — are copied byte for byte.
Are license comments removed?
No. Comments that begin with /*! — the convention used for licenses, copyright notices and credits — are always preserved, even with comment removal switched on. Ordinary /* */ comments are removed.
Why are 0% and 0s left alone?
Because zero is not always unit-free. 0% is a keyframe selector and is required inside functions like hsl(); times always need a unit, so 0s and 0ms cannot become 0; and angles are safest with theirs. This tool only strips units from zero lengths — 0px, 0em, 0rem and friends — where the unit genuinely changes nothing.
Should I minify if my server already uses gzip or Brotli?
Yes — they stack. Compression removes repeated byte patterns from whatever it is given, and minification removes bytes that compression can only shrink, not delete. A minified stylesheet also parses slightly faster. Minify first, then let gzip or Brotli compress the result for transfer.
Why should I keep an unminified copy of my CSS?
Minified CSS is hard to read, search and debug. Keep the indented original as your source of truth, edit that, and regenerate the minified version whenever you publish — the same workflow as compiled code. The session panel on this page keeps your recent versions one click away while you work.
Is my CSS uploaded or saved?
No. Minification happens entirely in your browser as you type; nothing is uploaded, stored or tracked. Session history lives only in this tab's memory and disappears when you close it.
Related encoding & conversion tools
About this tool
The CSS Minifier is one of the free utilities in the Online Utilities Suite at dev.conversiontools.online. Every tool runs entirely in your browser — your code is never uploaded, stored or tracked — so minification is instant and private, and the byte counts you see are measured on the exact text in the box, in UTF-8 bytes.
Privacy
This page processes everything locally in your browser: no account, no uploads, and nothing you paste is stored or sent to a server. Advertising on this site is served by Google AdSense, which may use cookies to personalize ads; you can opt out of personalized advertising in your Google ad settings.