Skip to content

CSS Minifier

Shrink CSS by removing whitespace and redundant code.

Everything runs in your browser. Nothing is uploaded.

More Developer Tools

All tools

How to use the CSS minifier

Three steps, all in your browser.

  1. 1

    Paste your input

    Type or paste your code or data. Press Sample to try an example.

  2. 2

    Pick the style

    Choose indentation or options. The result updates as you type.

  3. 3

    Copy the result

    Copy the output in one click. Nothing is saved or sent anywhere.

CSS Minifier: what to know

The CSS minifier uses CSSO (CSS Optimizer), an open-source minifier that goes beyond removing whitespace. Besides stripping spaces, line breaks and comments, it rewrites values in shorter equivalent forms (#ffffff to #fff, 0px to 0, bold to 700 where safe) and merges or removes rules when that can't change the result.

Structural optimization is what sets CSSO apart: identical declarations in neighboring rules can be merged and overridden declarations removed. It only makes changes it can prove are safe under the cascade, so a valid stylesheet should render the same. The tool shows the size before and after.

Comments that start with /*! are a convention for license notices, and CSSO keeps the first one. Keep your original, readable CSS as the source; minified CSS is a build output, not something to edit.

Popular uses

  • Shrinking CSS for a static site with no build step
  • Minifying a snippet for an email or CMS
  • Checking how much smaller a stylesheet can get
  • Preparing inline critical CSS for the head of a page

Tips for the best result

  • Serve CSS with gzip or Brotli too: compression and minification add up.
  • Test the minified CSS on the real page, especially if the stylesheet relies on browser hacks.
  • Small inline critical CSS benefits most, because it's sent with every HTML page.

Read how JustYourDev works and our privacy details. Code, data and files you use here are processed in your browser and are never sent to our server.

Frequently asked questions

Whitespace, comments and the last semicolon in each block, plus safe structural optimizations by CSSO, such as shortening colors (#ffffff to #fff), dropping zero units and merging identical rules.

CSSO only applies changes that keep the same meaning, so a valid stylesheet should behave the same. Still test the result, especially with unusual hacks or invalid CSS, and keep the original source for editing.

Yes. CSSO keeps the first comment that starts with /*!, the convention for license notices that must stay in shipped code.

No. Every tool runs in your browser, so your code, tokens, keys and files are processed on your device and are not sent to our server or stored. Reloading or closing the page clears them.

Yes. Every tool is free with no sign-up and no limits on use. Clearly labeled ads keep it that way.

Yes. The tools work in any modern browser on phones, tablets and computers, though large files and long code are easier to handle on a computer.