This tool runs entirely on your device. Your files and the text you enter are processed by your browser and are never sent to a server.
CSS Minifier
Paste CSS and get a smaller stylesheet as you type, with the bytes saved and a gzip estimate. Switch to Beautify to make minified CSS readable again.
Paste code, or drop a .css file here. 585 B
585 B → 437 B25.3% smallergzip ≈ 305 B
Runs entirely in your browser. Your code is never uploaded; only your options are remembered on this device.
Minifying scripts? Use the JavaScript Minifier.
How to minify CSS online
- Paste or open your CSS. Paste a stylesheet into the left box, or open or drop a .css file (up to 10 MB). A sample is loaded so you can see a result first.
- Choose the minify options. Restructure merges duplicate selectors and declarations for the smallest file; turn it off for a safer, whitespace-and-comments-only result. Keep /*! … */ comments preserves license and copyright notices.
- Check the result. The minified CSS appears on the right as you type, with the size before and after, the percentage saved and an estimated gzip size. A syntax error shows its line and column, with a button to jump to it.
- Copy or download. Copy the result or download it as a .min.css file, then check your pages with the new stylesheet before you deploy it.
- Beautify minified CSS. Switch to the Beautify tab to turn a one-line stylesheet into readable CSS, with a 2-space, 4-space or tab indent and optional line wrapping.
Features
- Minify CSS with CSSO: remove whitespace and comments and shorten colors, numbers and units
- Restructure option: merge duplicate selectors and declarations for a smaller file
- Keep /*! license and copyright comments
- Modern CSS (nesting, range media queries) is minified safely by removing whitespace and comments only
- Beautify (unminify) CSS with a 2-space, 4-space or tab indent and optional line wrapping
- Size before and after, percent saved and an estimated gzip size
- Syntax errors with line and column, and a button to jump to the problem
- Open or drop .css files; copy or download as .min.css
- Options are remembered in your browser; files up to 10 MB, with a Run button for large ones
- Free, no signup; your CSS is processed on your device and never uploaded
Minification by CSSO (MIT licence) and formatting by js-beautify (MIT licence), both running in your browser. Check your pages after minifying, especially with Restructure on.
Frequently Asked Questions
What does a CSS minifier do?↓
It rewrites a stylesheet into the shortest CSS that styles the page the same way. It removes whitespace, line breaks, comments and the last semicolon in each block, and shortens values, for example #ffffff to #fff, 0px to 0 and 0.5 to .5. With Restructure on, CSSO also merges rules that share selectors or declarations and removes overridden ones. A smaller stylesheet downloads faster, and CSS blocks page rendering until it arrives.
How much smaller will my CSS get?↓
Hand-written, commented CSS often shrinks by roughly 20 to 50 percent; stylesheets with many repeated rules can save more with Restructure on, and already minified CSS barely changes. The tool shows the exact size before and after and an estimated gzip size, which is closer to what visitors actually download.
Is it safe? Can minifying break my styles?↓
Removing whitespace and comments does not change how CSS works. Restructuring is also designed to keep the result the same, but because it moves and merges rules, unusual stylesheets (such as ones that rely on browser hacks or rule order across separate files) are worth checking. If something looks different, turn Restructure off. Newer CSS features such as nesting and range media queries (width >= 600px) are handled safely: when the stylesheet uses them, the tool removes only whitespace and comments and shows a note, so the result is safe but saves less. Invalid CSS shows a syntax error with its line and column. Always check your pages with the minified file before deploying it, and keep the original.
What does Restructure do?↓
It lets CSSO change the structure of the stylesheet, not just its spacing: rules with identical declarations are merged into one selector list, rules with the same selector are combined, and declarations that a later rule overrides are removed. It usually saves the most bytes. With it off, the minifier only removes whitespace and comments and shortens values, keeping every rule where it was.
Will it keep my license comments?↓
Turn on Keep /*! … */ comments. Comments that start with /*! are the usual way to mark license and copyright notices that must stay in the minified file; other comments are always removed.
Should I minify or gzip my CSS?↓
Both. Minifying removes characters the browser does not need, and gzip or Brotli compression on the server then shrinks what is left for transfer. Minified CSS still compresses well, so the combination is usually much smaller than either alone. The gzip figure shown here is an estimate; your server's settings decide the real number.
Can I unminify CSS, and what is the difference from a CSS beautifier?↓
Yes: the Beautify tab is a CSS beautifier (formatter). It puts each rule and declaration on its own line with consistent indentation, so minified or messy CSS is easy to read and edit. Minify does the opposite for production. Comments removed during minifying cannot be brought back, so keep your original source.
Is my CSS uploaded or stored?↓
No. Minifying and beautifying run in your browser with CSSO and js-beautify, which are part of this page, so nothing is downloaded from another site and your CSS is never uploaded or stored. Only your option choices are remembered in this browser, and the anonymous usage statistics record only the action and a rough size range, never the code.
You might also need
All Text & Dev Tools →JavaScript Minifier
Minify JS with Terser, or beautify it back.
HTML Beautifier
Format messy HTML, or minify it safely.
CSS Box Shadow Generator
Layered CSS shadows and neumorphism presets.
CSS Unit Converter
Convert px, rem, em, pt, vw and vh.
CSS Gradient Generator
Build linear and radial CSS gradients.
Diff Checker
Compare two texts side by side.
Last updated: