Skip to content

Minify CSS

Compress stylesheets by stripping comments and whitespace, shortening colors and zero units — locally, nothing uploaded.

Last updated

How to use minify css

  1. Paste your CSS into the input box, or tap Load file to pick a .css file from your device.
  2. Press Minify CSS. The first run downloads the optimizer (~170 KB, then cached); later runs are instant.
  3. Read the size summary under the output — bytes before, bytes after and the percentage saved.
  4. Copy the minified stylesheet or download it as a .min.css file, then keep your formatted original for editing.

Examples

Minify a commented rule

A commented, spaced-out rule with a long-form color becomes one tight line.

Shrink a media query block

Responsive rules minify just as well — indentation and zero units are stripped throughout.

What is Minify CSS?

Stylesheets grow fast in a real project: comments explaining decisions, generous indentation, long color codes, vendor prefixes. Browsers need none of it. Minifying CSS rewrites a stylesheet into the shortest form that produces identical rendering — comments and whitespace removed, #ffffff shortened to #fff, 0px collapsed to 0, duplicate and overridden declarations cleaned up.

This CSS minifier runs clean-css, the optimizer bundled with countless build pipelines, directly in your tab. Paste a stylesheet or load a .css file and the tool reports the byte count before and after along with the percentage saved. A 40 KB stylesheet often lands under 30 KB, which is real money on a busy site: CSS is render-blocking, so every kilobyte delays first paint.

One habit worth keeping: always minify a copy, not the original. The minified output is painful to edit by hand, so treat it as a build artifact and keep your readable source as the file you maintain. Since everything happens on your device, in-progress designs and client work never leave your machine.

Frequently asked questions

What does minify CSS mean?

It means rewriting a stylesheet into the smallest text that a browser will interpret identically. Comments, line breaks and indentation are removed, colors and numbers are shortened (#ffffff becomes #fff, 0px becomes 0), and redundant rules are merged or dropped. The rendering stays exactly the same — only the byte count changes.

Can I minify my CSS code online safely?

Yes, and with this tool nothing even leaves your browser — the optimizer runs locally in the tab. That said, always keep your formatted source: minified CSS is effectively write-only, so minify a copy for production and edit the original.

How do I minify JS and CSS together?

Minify each file with the matching tool — this page for stylesheets, and the Minify JavaScript page (linked below) for scripts. HTML pages that embed styles and scripts can go through the Minify HTML tool, which minifies inline <style> and <script> blocks as part of the document.

Will minifying change how my site looks?

No. The transformations are semantics-preserving: the same selectors, the same computed values, the same cascade. If something looks different after minifying, the original CSS almost certainly contained an error that the browser was tolerating — check the console for warnings.

Is minified CSS enough, or do I need gzip too?

Both help and they stack. Minification shrinks the raw text; gzip or brotli then compresses it further during transfer. A typical pipeline is minify at build time, let the server or CDN compress on the wire, and the browser decompresses transparently.

Browse all developer tools.