Skip to main content
CSS Tool

CSS Minifier / Beautifier

Strip comments and whitespace from a stylesheet to ship a lighter CSS file, or expand minified CSS back into readable rules.

Mode
Input701 characters · 46 lines · 701 B
Result532 characters · 1 line · 532 B
.navbar{display:flex;align-items:center;justify-content:space-between;padding:1rem 2rem;background-color:#1e293b;color:white}.navbar .logo{font-size:1.5rem;font-weight:700;text-decoration:none;color:inherit}.navbar .nav-links{display:flex;gap:1.5rem;list-style:none;margin:0;padding:0}.navbar .nav-links a{color:#94a3b8;text-decoration:none;transition:color 0.2s ease}.navbar .nav-links a:hover{color:white}@media (max-width:768px){.navbar{flex-direction:column;gap:1rem}.navbar .nav-links{flex-direction:column;align-items:center}}
24% smaller
Learn more

Minifying CSS: the essentials

Minify for production, beautify to read

Minifying removes everything the browser doesn't need (comments, indentation, line breaks, the last semicolon of each rule), typically saving 20 to 50% before compression. Beautifying does the opposite: paste the minified CSS of a site or a library to read and debug its rules.

What it doesn't change

Selectors, values and the order of rules stay exactly as they were, so the page renders the same. It doesn't remove unused rules or merge selectors: for that, use a build tool. Most sites also serve CSS with gzip or Brotli, which shrinks it further on top of minification.

How it works

How to minify CSS

  1. Paste your CSS

    Paste CSS code into the input panel. Sample styles are provided to get you started.

  2. Choose minify or beautify

    Select Minify to compress or Beautify to format. The size savings are shown after minification.

  3. Copy the result

    Copy the optimized CSS or download it. Beautify puts one declaration per line and one selector per line, without changing strings, url() values or selectors.

Practical guides

Tips & guides

Optimize page speed

Minified CSS loads faster because there's less data to transfer. For production websites, minification is a standard optimization that reduces initial load time.

Combine minification with gzip compression on your server for even better results — typically 70-90% total reduction in CSS file size.

Pro tip

Private

Your CSS stays in your browser. Nothing is uploaded, stored, or tracked.

Proprietary stylesheets and design systems stay on your device while you minify or format them.

Privacy
Frequently asked questions

Frequently asked questions

Everything you need to know about CSS minification