Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

CSS Minifier

Paste a stylesheet to shrink it instantly. You’ll see the original and minified size, the percentage saved and the gzipped size — and you can beautify it back at any time.

Mis à jour le
 
Minified CSS
 

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : CSS Minifier

  1. Paste your CSS, drop a .css file onto the input, or click Sample.
  2. Leave the optimizations on (all are safe) or untick any you don’t want.
  3. Check the savings below the editor, then Copy or Download styles.min.css.
  4. Need to read a minified file instead? Switch to Beautify.

What is CSS minification?

CSS minification removes every byte the browser doesn’t need — comments, indentation, line breaks, the last semicolon in each rule — and rewrites some values into shorter equivalents. The resulting stylesheet is functionally identical but smaller, so it downloads and parses faster. Because CSS is render-blocking, a smaller stylesheet can directly improve First Contentful Paint and Largest Contentful Paint.

What this minifier changes

OptimizationBeforeAfter
Comments & whitespace/* Buttons */ .btn , .link { … }.btn,.link{…}
Last semicolon{color:red;}{color:red}
Colors#FFFFFF, #aabbccdd#fff, #abcd
Zero unitsmargin:0px 0emmargin:0 0
Numbers0.50rem, 1.0.5rem, 1
Empty rules.unused{}(removed)

Why it is safe

Aggressive minifiers sometimes break stylesheets. This one only applies transformations that can’t change behavior:

  • Strings, url() values and escaped characters are protected and never modified.
  • Units are only dropped on lengths — 0s, 0deg and 0% keep theirs (transition: 0s and keyframe selectors need them), and nothing inside calc(), min() or clamp() is touched because calc(0 + 10px) is invalid.
  • The flex shorthand is skipped (flex: 1 1 0px and flex: 1 1 0 are not always equal in older engines), and custom property values only lose redundant spaces.
  • Whitespace in selectors is kept where it means something: a :hover (any hovered descendant) differs from a:hover.
  • @layer name {} is kept even when empty, because it declares layer order. License comments starting with /*! are preserved by default.

Minification vs. compression

Minifying and gzip/Brotli compression stack. Compression removes repetition; minification removes bytes compression can’t, such as comments. The Gzipped output figure shows roughly what will travel over the network if your server compresses responses (most do). For the biggest win, also remove unused rules with a tool like PurgeCSS, and inline only the critical CSS for above-the-fold content.

Want to inspect a minified file? Use Beautify mode here or the CSS Formatter. Checking a whole page’s performance? Run a page speed test.

Aussi recherché comme : minify css, css compressor, compress css, css optimizer, reduce css size, css minify online, cssnano alternative, css uglify.

Outils complémentaires : CSS Minifier

  • HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.
  • JavaScript Formatter — Unminify and pretty-print JavaScript, JSON or JSX with your preferred indentation and brace style — or strip whitespace and comments with a verified minifier.
  • Compresseur d’images — Réduisez la taille de vos photos et de vos graphiques de 50 à 90 % sans perte de qualité visible.
  • SQL Formatter — Paste a query — or a whole migration — and get readable SQL with one clause per line, aligned joins and consistent keyword case, using the grammar of your database.

Questions fréquentes

Can minifying break my CSS?
Not with these settings: every optimization is limited to cases where the result is equivalent (for example units are only removed from zero lengths outside calc()). If your original CSS has a syntax error, the error stays in the output, so validate CSS that behaves strangely.
How much smaller will my CSS get?
Hand-written, commented CSS typically shrinks by 20–40%. Already-compact framework builds save less. The stats panel shows the exact saving and the gzipped size.
Should I still use gzip or Brotli?
Yes. Minification and HTTP compression complement each other: minify first, then let your server or CDN compress the file. Together they usually cut CSS transfer size by 80–90%.
Why are some comments kept?
Comments starting with /*! conventionally contain license notices that must stay with the code. Untick “Keep /*! license */ comments” to remove them too.
Does it remove unused CSS?
No. Finding unused selectors requires your HTML and JavaScript — use a tool like PurgeCSS or the Coverage tab in Chrome DevTools for that.
Is my stylesheet uploaded?
No, minification runs locally in your browser and nothing is sent to a server.
Puis-je installer CSS Minifier en tant qu’application web et l’utiliser hors ligne ?
Oui. CSS Minifier est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires