Minify CSS — strip comments, whitespace, shorten colors, merge selectors. 30-60% smaller.
- Runs locally
- Category Format Converter
- Best for Turning pasted content or local files into a handoff-friendly format.
Minified output appears here.What this tool does
Free online CSS minifier and compressor. Paste raw CSS and get a production-tight single-line output, typically 30-60% smaller than the input. Every optimization is a toggle you can disable: strip comments (but keep /*! important banners */), collapse whitespace, shorten hex colors (#ffffff → #fff), convert rgb()/rgba() to hex when fully opaque, drop the `px` on zero values (0px → 0), trim the leading zero on decimals (0.5 → .5), collapse identical 4-value margin/padding shorthand (margin: 5px 5px 5px 5px → margin: 5px), and drop the redundant trailing semicolon at the end of every block. The brace-aware tokenizer is the same one shipping in our CSS formatter, so urls, strings, calc(), @media, @keyframes, and nested rules all round-trip cleanly. Live size diff (before / after / saved %) prints under the output. 100% client-side — your design tokens, internal theme files, and unreleased vendor CSS never leave the tab. Need pretty-printed CSS back instead? Use our CSS Formatter — they share the same parser so you can round-trip without churn.
Tool details
- Input
- Text + Structured content
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy + Download
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- No account required
- Open the page and use it; whether results survive refresh depends on the tool.
- Performance budget
- Initial JS <= 14 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Format Converter · Developer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How CSS Minifier fits into your work
Use it when the main problem is getting content from one practical format into another.
Conversion jobs
- Turning pasted content or local files into a handoff-friendly format.
- Previewing a conversion before you use it in a larger workflow.
- Cleaning small format mismatches without opening a full editor.
Conversion checks
- Try a small sample first when the source format is messy.
- Check character encoding, separators, and line endings after conversion.
- Keep the source until the converted output has been reviewed.
Good next steps
These links move the current task into a more complete workflow.
- 1 JS Minifier Minify JavaScript — strip comments, whitespace, optional name shortening. 40-70% smaller. Open
- 2 HTML Minifier Minify HTML — strip comments, whitespace, optional attributes, inline CSS/JS. 40-60% smaller. Open
- 3 CSS Formatter & Minifier Format and beautify CSS — sort properties, indent rules, expand or minify. Open
Real-world use cases
Shrink a vendor stylesheet before pasting into a marketing email
An email template shop ships a 28KB hero-banner stylesheet from a third-party widget. Outlook chokes past ~16KB of inline styles, so you paste the block here, leave "Preserve /*! comments" on for the license header, and get a 11KB single line. That fits the inline budget and the banner renders in Outlook 2019 without the silent truncation that was dropping the footer.
Slim a CodePen demo so the embed loads fast on a blog post
You wrote a 540-line CSS demo with verbose comments explaining each keyframe. For the blog embed you want the JS-tab payload tiny. Run it through with comment stripping on, zero-unit and leading-zero trims enabled, and the panel goes from 19KB to 8KB. The iframe now paints under 200ms on a throttled 3G profile instead of stalling.
Compare your hand-tuned output against cssnano without a build
A teammate claims cssnano squeezes 40% off the design-system CSS. You have no build set up locally. Paste the 1,200-line tokens file, read the live "saved %" under the output, and you get 37% with the default toggles. Now you have a real number to bring to the PR discussion instead of guessing, and you saw exactly which transforms moved the needle.
Audit which optimization actually saves bytes on your CSS
You suspect hex shortening barely matters for your palette but whitespace collapse does. Toggle each transform one at a time and watch the "saved %" jump: whitespace alone takes 9,400 bytes to 6,100, while hex shortening shaves only 80. Now you know your real win is minification of structure, not color rewriting, and you can drop the risky transforms.
Common pitfalls
Stripping all comments and losing a required license banner. Keep "Preserve /*! comments" on, then mark the banner as /*! ... */ so the MIT or Apache notice survives the pass.
Assuming the minifier merges duplicate rules. It does not reorder or merge across rules by design, so `.a{color:red}.a{color:red}` stays as two rules. Dedupe in your source if you want that.
Minifying CSS that relies on a literal `0px` IE hack, then watching the layout break. Toggle off "Drop zero units" before running so `margin:0px` is not collapsed to `margin:0`.
Privacy
Everything runs in your browser tab. The CSS you paste is parsed and minified locally with JavaScript and never uploaded to any server. The input is not written to the URL, so design tokens, internal theme files, and unreleased vendor CSS stay private even if you copy the page link. Close the tab and nothing persists.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- 555 Timer Calculator Astable f = 1.44/((R1+2R2)C) + monostable t = 1.1RC — pick R1, R2, C in Ω/kΩ and µF/nF, read frequency, duty cycle and pulse width — browser-only
- Add Line Numbers Number every line of pasted text — set start, step and separator, zero-pad to align, skip blanks, or strip numbers back off — browser-only
- AES Text Encryptor Encrypt & decrypt text with a password — AES-256-GCM + PBKDF2 via WebCrypto — 100% in your browser, nothing uploaded
- Affine Cipher Encoder & Decoder Encrypt and decrypt the ax+b affine cipher with live modular-inverse check, browser-only