Skip to content
DoItJag

CSS Minifier

Make a stylesheet smaller for faster page loads. Safe mode keeps every rule in its original order.

or drop a file here · .css, .txt · up to 20 MB

Options

About the CSS Minifier

Browsers must download and parse every stylesheet before they draw the page, so CSS size has a direct effect on how quickly a site appears. This minifier removes comments and whitespace and rewrites values in their shortest equivalent form, using CSSO, an established open-source CSS optimiser.

When to use it

  • You maintain a small site or a WordPress child theme without a build pipeline.
  • You want to paste compact CSS into a page builder’s custom code box.

Worked example

With the button styles from Try an example in the box, keep the default options and press Minify CSS. The result is one line. The “Buttons” comment is gone, white written as #ffffff becomes #fff, the blue #0055aa becomes #05a, and spaces around colons, braces and commas disappear. The label above the result compares the sizes.

The two options

Keep licence comments. Libraries such as Bootstrap start with a comment beginning /*! that carries their licence. Licences often require that notice, so this stays on by default. All other comments are removed.

Merge and reorder rules. CSSO can combine rules that share a selector or the same declarations, and drop declarations that are overridden later. This saves more bytes, but rule order is part of how CSS decides which style wins, so in rare cases the page can look different. It is off by default. Turn it on only if you can test the result in a browser.

What is always safe

  • Shortening colours, zeros and units, such as 0px to 0.
  • Removing the last semicolon in a block and empty rules.
  • Removing whitespace that has no meaning.

Good to know

  • The minifier does not check for mistakes; invalid declarations are generally passed through.
  • Keep your readable source. The CSS formatter can lay out minified CSS again, but removed comments cannot be restored.
  • For a whole page, the HTML minifier can minify embedded style blocks too.

How to use CSS Minifier

  1. Paste CSS or open a .css file.
  2. Choose whether to keep licence comments and whether to merge rules.
  3. Select Minify CSS, check the size saved, then copy or download the result.

Privacy: how it works

Everything happens in your browser. Your text is not sent to any server.

Frequently asked questions

What does "Merge and reorder rules" do?

It combines rules with the same selector or the same declarations for a smaller file. Rule order can matter in CSS, so this is off by default; turn it on only if you can test the result.

Which comments are kept?

Comments that start with /*! are kept when the licence option is on. Many libraries use them for their licence notice. All other comments are removed.

Which engine does it use?

CSSO, an open-source CSS minifier, running in your browser.