Esta página ainda não foi traduzida para o português, por isso aparece em inglês.

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.

Atualizado em
 
Minified CSS
 

Seus dados nunca saem do seu computador. Todo o processamento acontece localmente no navegador.

Como usar: 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.

Também pesquisado como: minify css, css compressor, compress css, css optimizer, reduce css size, css minify online, cssnano alternative, css uglify.

Ferramentas que combinam com: 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.
  • Compressor de imagens — Reduz o tamanho das fotos e dos gráficos em 50–90% sem perda visível de qualidade.
  • 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.

Perguntas frequentes

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.
Posso instalar o CSS Minifier como um aplicativo da web e usá-lo offline?
Sim. O CSS Minifier é um aplicativo da web instalável (PWA) — instalado a partir do seu navegador, não baixado de uma loja de aplicativos. Clique em “Instalar aplicativo” na parte superior desta página no Chrome ou no Edge (Windows, macOS, Linux, ChromeOS) ou, no Android, use “Compartilhar” → “Adicionar à tela inicial” no iPhone e no iPad, ou “Arquivo” → “Adicionar ao Dock” no Safari 17+ em um Mac. Em seguida, ela se abre em uma janela própria com seu próprio ícone e, como é executada inteiramente no seu navegador, continua funcionando offline. O Firefox no desktop não permite a instalação de aplicativos da web. Como funciona a instalação.

Ferramentas relacionadas