Quick answer
To minify CSS, paste your stylesheet into the CSS code box or upload a .css file, then click Minify CSS. The tool removes comments (keeping important /*! */ licence comments), whitespace and line breaks, the last semicolon in each rule and empty rules; shortens colours like #ffffff to #fff, 0px to 0 and 0.5 to .5. You see the original size, new size and percentage saved, and can copy or download style.min.css.
- Removes:
- Comments, whitespace, line breaks, empty rules
- Shortens:
- #ffffff → #fff, 0px → 0, 0.5 → .5
- Cleans:
- Last semicolon before }
- Keeps:
- /*! licence comments */ and strings
- Input:
- Paste CSS or upload a .css file
- Output:
- Copy or download style.min.css
- Upload needed:
- No – runs in your browser
- Price:
- Free
CSS is render-blocking: browsers will not show a page until they have downloaded and parsed the stylesheets in the head. That makes the size of your CSS one of the most direct influences on how quickly visitors see your site. Hand-written stylesheets — and those exported by design tools and themes — are full of comments, indentation, blank lines, long colour codes and redundant units that browsers do not need.
Our CSS minifier removes all of that without changing how your styles work. It strips comments and whitespace, removes the optional last semicolon before every closing brace, deletes empty rules, writes zeros without units and shortens six-digit colours to three digits where possible. Strings such as font names and content values are protected, and licence comments starting with /*! are kept, as many open-source licences require.
Paste your code or upload a .css file, and you get the minified version instantly along with the original size, new size and the percentage saved. Copy it or download it as style.min.css ready to deploy. Everything happens in your browser, so your stylesheets stay private.
How to minify CSS – step by step
- 1 Add your CSSPaste the stylesheet or upload a .css file.
- 2 MinifyClick Minify CSS. The compact version appears instantly.
- 3 Check the savingsCompare original and minified sizes and the percentage saved.
- 4 Test your siteReplace the stylesheet on a test page and check that everything looks the same.
- 5 DeployDownload style.min.css and link it in your HTML, keeping the readable original for editing.
Why use this CSS minifier?
Safe optimisations
Only removes characters browsers do not need.
Shorter values
Colours, zeros and decimals written in their shortest form.
Licence comments kept
/*! … */ comments stay in the output.
File upload and download
Work with .css files directly.
Size statistics
See exactly how much you saved.
Private and free
Runs in your browser, no sign-up.
What the CSS minifier changes
| Optimisation | Before | After |
|---|---|---|
| Remove comments | /* Header styles */ | (removed) |
| Remove whitespace | .btn { color: red; } | .btn{color:red} |
| Drop last semicolon | {color:red;} | {color:red} |
| Zero units | margin: 0px | margin:0 |
| Short colours | #ffffff, #aabbcc | #fff, #abc |
| Leading zeros | opacity: 0.5 | opacity:.5 |
| Empty rules | .old{} | (removed) |
How much does minification save?
Well-commented, nicely formatted stylesheets typically shrink by 20–40%; framework builds that are already partly compact save less. With gzip or Brotli on the server, the transferred difference is smaller, but minified CSS still downloads and parses faster, and the gains add up across every page view. For the biggest improvement, also remove CSS you do not use — many sites load entire frameworks and theme stylesheets but use only a fraction of the rules.
Minification vs. removing unused CSS
Minifying makes the same CSS smaller; removing unused CSS deletes rules that no page uses. The second often saves far more. Chrome DevTools' Coverage tab (More tools → Coverage) shows which rules are unused on a page. Tools like PurgeCSS remove unused selectors at build time, and Tailwind CSS generates only the classes you use. WordPress optimisation plugins such as LiteSpeed Cache and WP Rocket offer "remove unused CSS" features. After cleaning up, minify the result here.
Critical CSS for faster first paint
Because CSS blocks rendering, a common technique is to inline the small amount of CSS needed for the visible top of the page — the critical CSS — directly in the HTML head, and load the rest asynchronously. Minify the critical CSS first so the inline block is as small as possible, then place it in a <style> tag. Our HTML Minifier can then compact the whole page including that inline style.
Organising CSS before you minify
Minification works best on a stylesheet that is already tidy. Before minifying, remove rules for features you no longer use, combine duplicate selectors, and replace repeated values with CSS custom properties (variables) such as --brand: #ea580c, which makes the source easier to maintain and often shorter. Group related rules — layout, typography, components, utilities — and keep media queries near the components they affect. Use a consistent order of properties so duplicates are easy to spot. These habits keep the readable source small, and the minified output then becomes even smaller. If you manage colours in several formats, convert and standardise them with the Color Converter.
Keep source files readable
Never edit minified CSS directly — it is almost impossible to read. Keep your formatted stylesheet as the source, ideally in version control, and regenerate the minified version whenever it changes. Many projects use a naming convention like style.css for the source and style.min.css for the production file. If you need to debug production styles, browser developer tools can pretty-print minified CSS.
Should you combine CSS files?
Under the old HTTP/1.1 protocol, every file needed its own connection, so combining all stylesheets into one big file was standard advice. With HTTP/2 and HTTP/3, which most hosts now support, browsers download many small files in parallel over one connection, so combining matters less. What still matters is the total amount of render-blocking CSS and how well files are cached. A practical approach: keep a small critical stylesheet, load page-specific styles only where needed, and minify everything.
Cache-busting after updates
Browsers cache stylesheets, sometimes for months. After deploying a new minified file, visitors may still get the old one. Add a version to the filename or URL — style.min.css?v=2 or style.3f9a.min.css — so browsers fetch the new version. Build tools do this automatically with content hashes.
Minifying CSS in WordPress and other platforms
On WordPress, themes and plugins enqueue many stylesheets; minifying them by hand is impractical. Use an optimisation plugin to minify and combine them automatically, and use this tool for custom CSS you paste into the Customizer or a child theme. On Shopify, theme CSS is served through Shopify's CDN; minify custom snippets before adding them. For hand-built sites, pair this tool with the JS Minifier and image optimisation from the Image Compressor.
Speed, Core Web Vitals and SEO
Large render-blocking stylesheets delay First Contentful Paint and Largest Contentful Paint, two metrics in Google's page experience signals. Smaller CSS helps both. Check your page's speed with the performance score in our Website Screenshot tool before and after optimisation, and make sure the server compresses CSS using the HTTP Headers Checker.
Privacy
The minifier runs locally in your browser. Your stylesheets — which may belong to unreleased designs or client projects — are never uploaded or stored.
Troubleshooting
- Styles look different after minifying. Check for CSS that relied on comments or invalid syntax; validate the original stylesheet.
- A licence comment disappeared. Start it with /*! to keep it.
- calc() values. Spaces around + and - inside calc(), clamp(), min() and max() are required by CSS, so the minifier keeps them.
- Old styles still load. Clear caches and add a version to the stylesheet URL.
Frequently asked questions
What is CSS minification?
Removing unnecessary characters from CSS — comments, whitespace and redundant values — without changing how it works.
Is minified CSS safe?
Yes. It produces the same styling; test once after replacing your stylesheet.
How much smaller will my CSS be?
Usually 20–40% for formatted stylesheets.
Does it keep licence comments?
Yes. Comments starting with /*! are kept.
Can I upload a CSS file?
Yes. Upload a .css file and download the minified version.
Does minified CSS improve SEO?
Indirectly, by speeding up page rendering.
Can I unminify CSS?
Browser developer tools can pretty-print it, but removed comments are gone. Keep your source file.
Is my CSS uploaded?
No. Everything runs in your browser.
Should I also remove unused CSS?
Yes. It often saves more than minification alone.
Is the CSS minifier free?
Yes. No sign-up required.
Does it work with SCSS or Less?
Compile SCSS or Less to CSS first, then minify the CSS output.
Does it keep calc() working?
Yes. Spaces inside calc(), clamp(), min() and max() are kept, because CSS requires them around + and -.
Will minifying break media queries?
No. Media queries, keyframes and other at-rules are kept; only spacing inside them is reduced.
Can I minify CSS from a theme?
Yes, paste it here, but WordPress and Shopify themes are better optimised with a plugin or app that updates automatically.
Last updated November 21, 2026 · Written and tested by the SmallEasyTools team.