Cookies This site keeps only what it needs to work. There is no analytics and no advertising on it today, and nothing here follows you to other sites. Read the privacy policy

Choose what to allow
+92 312 8299940Free Quote
EN – Language: English
Free, nothing uploaded

CSS Minifier
A Tool For Smaller Stylesheets, Same Design

This free CSS minifier works online, strips the comments and spacing out of your stylesheet and hands back a smaller file. First, paste your CSS or drop your files. Then press one button. Finally, copy the result, because the whole job happens in this tab.

  • FreePrice
  • Not neededAccount
  • NoneUploads
  • Every runChecked

CSS Minifier

Paste a stylesheet or drop your files — nothing is uploaded

or press Ctrl + Enter

Minified result

 
Original
—
Minified
—
Saved
—
Gzipped
—
Rules
—
Took
—

Ready. Paste your CSS, then press Minify or Beautify.

Your browser reads and rewrites your stylesheet here, in this tab. We upload nothing, store nothing and log nothing.

Run it on a test page before the live one

Keep a copy of your original code and try the result on a test page before you replace the live file. No automatic tool can see every way your site uses its code.

Add a link to this tool on your own site

Copy the code below and drop it into your page. It places a link to this free tool.

Guides for this tool

Articles with worked examples, tables and a short video that help you get more from this tool.

  • Rem or Px in CSS: What to UseRem or Px in CSS: What to Use

    Rem vs px in CSS: the real difference, accessibility, when to use each, and a conversion table.

    9 minutes of reading · video guide inside

The short version

Inside the Denwix CSS Minifier: What It Strips and What It Keeps

A CSS minifier rewrites a stylesheet you wrote for people into one a browser downloads faster. It throws away your comments, your indentation and the gaps that only help a reader. However, it keeps every rule you wrote, so the page still looks exactly the same.

Saving is important since a style sheet prevents rendering. A browser doesn’t render any pixels until it gets your CSS; so, each byte you remove from your style sheet will arrive before the first render instead of after it. So, a style sheet which is reduced from 60 KB to 42 KB displays your design earlier.

Some people refer to this as a CSS Compressor. Both terms mean the same thing -- fewer characters and the same function. In other words, you will send the smaller file and have the readable file available.

Minifying safely means knowing what the parser needs. MDN's reference for CSS syntax is the shortest honest description of that.

Where Most Tools Quietly Break Your CSS

Three traps cause almost all of the problems. And a tool created using find-and-replace will fall into each of these three traps. First, the space around the minus sign in calc(100% - 20px) is required. If you remove the spaces, the entire declaration will be ignored by the browser, causing your layout to fail without any indication of what went wrong.

Diagram of a CSS file packed down: comments, spaces and zero units removed, with the byte saving shown beside it
Same styles, fewer bytes.

The second distinction is that .card.title and .card.title will target two different sets of elements. This separation is called the descendant combinator, which has significance. The third distinction is that when using a data URI within url(), the semicolons and commas are part of the data, and so are not used as delimiters.

CSS minifier with a short stylesheet on the left and the packed one-line result on the right
Paste the CSS, get the packed copy.

This program parses your CSS file character-by-character, and so can find the specific spacing issue you want to address. This program will remove unneeded spaces, but leave necessary ones intact.

When to Minify CSS

Minify last, after you have built and tested. Keep your unminified stylesheet in your editor, but release the minified version, as it is impossible for anyone to manually change a minified file.

CSS minifier in beautify mode, turning one long packed line back into tidy indented rules
Beautify mode brings the layout back.

The greatest return comes from editing the style sheets for each page that is loaded. An example would be to pay close attention to a common style sheet used by all users compared to a user specific style sheet used on only one page.

CSS minifier with colour shortening and empty rule removal ticked, turning a blue hex code into three digits
Tick the options you trust, and run.

What About Unused CSS?

Removing rules nothing uses is a different job, and a risky one. A class your JavaScript adds later looks unused to a scanner, so this tool never guesses. It shortens what you have instead.

Video guide

A Quick Walkthrough of the CSS Minifier

This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.

How it works

Minify CSS in Four Steps

Zero installations, zero signups, zero lines. Everything is done within this single browser window.

  • Add your stylesheet

    You can use either method to add your CSS. You land on the same outcome with either method.

  • Choose what goes

    Comments are always on. You can reduce the size of your color names, and delete any rules where there isn’t anything inside the braces.

  • Press minify

    The tool walks every character, rewrites the sheet, and then reads its own answer back before it shows you anything.

  • Copy or download

    Copy the smaller version of the stylesheet, or save it as style.min.css. The original version will remain unchanged.

Why this one

A CSS Minifier That Checks Its Own Work

Browsers fail silently on broken CSS. They drop the declaration and carry on, so nobody tells you anything went wrong.

  • It protects calc()

    Spaces around a plus/minus will be preserved within calc(), clamp(), min(), and max(). This ensures that your calculations remain intact, as this is typically where minifiers cause silent issues.

  • It verifies every run

    The tool reads its own output back and compares it to what it meant to write. If anything differs, it tells you instead of staying quiet.

  • It knows your selectors

    A space between two selectors means "descendant", so it stays. Around a child or sibling combinator it means nothing, so it goes.

  • It passes url() through

    A Data URI may contain semicolons, commas, and parentheses. This tool treats the entire URL() as a single unit and copies each individual character.

  • Nothing leaves your tab

    Your stylesheet stays exactly where it was created. No requests, no logs, and no storage. This means you can even use this space for your client’s work and be confident that their data will remain secure.

  • You see the saving as it truly is

    You see the gzipped size beside the raw one, because gzip is what actually reaches your visitor.

Good habits

Getting the Most From This CSS Compressor

A few small habits keep a minified stylesheet predictable.

  • Keep the original. Edit the readable version of the file constantly. This ensures that the minimized version of the file is always created from the readable version and is never maintained.
  • Minify last. After Sass, after PostCSS and after your test. You will then be testing the exact same file that you ship.
  • Serve it gzipped. Minifying and compressing files results in much smaller file sizes than how they are represented on your computer.
  • Mind your licence banners. Leave the switch on if a framework that you’re using needs you to include an attribution comment with the code you use.
  • Check the empty-rules switch. An empty rule is left off by default so that a possible reason for leaving the rule empty is documented. But, you can enable it once you are certain that no such documentation is needed.
  • Watch the verified badge. Do not ship the file if you are informed that the run was unable to verify. Please inform us about the situation and retain the original file.
Avoid these

Mistakes That Break a Minified Stylesheet

Almost every "the minifier broke my design" story is one of these three.

  • Losing the calc spaces

    The tool used to remove them creates an invalid length from a valid one. After that, your layout will fail with no console errors.

  • Editing the minified file

    The changes will disappear when you next compile. So, your corrections must be made in the original style sheet.

  • Minifying twice

    Minifying a file that has been previously minified does not result in savings, but rather will make the next diff more difficult to read.

Questions

CSS Minifier FAQ

Will this CSS minifier break my design?

The tool verifies each run and determines if it wrote the correct content. It does not assume that each run is correct; rather, it verifies the run. The tool can find issues such as a missing brace or an incorrectly formatted URL() in a stylesheet and will notify the user of those issues instead of giving the user a damaged stylesheet.

Does it keep calc() working?

Yes, on a high-traffic site, those savings can quickly add up. In calc, clamp, min and max, the spacing around a plus (+) or minus (-) sign remains exactly as it was written, because removing that space would turn what was once a valid length into an invalid declaration, which would then be ignored by the browser.

By what percentage will the Denwix minifier shrink my CSS?

A readable sheet will typically drop from 20% to 40% of its size, and the program will show you exactly how much your sheet decreased. A sheet that was already compacted before shipping will be reduced much less, as there are fewer gaps to drop.

Does it remove CSS I do not use?

No. We built the Denwix version that way on purpose. A class your JavaScript adds later looks unused to any scanner, so guessing there would break real pages. This tool shortens what you wrote and leaves the decisions to you.

Does the Denwix CSS minifier send my stylesheet anywhere?

No. The whole minifier runs inside your browser tab. There is no request, no storage and no log, so you can safely paste work you cannot share.

Does the Denwix minifier take more than one file per run?

Yes. Open the upload tab and drop as many .css files as you like. The tool minifies each one separately, and you can download them one by one.

More free tools

More Denwix Tools Worth Opening Next

Every Denwix tool listed here runs locally, with no login and nothing uploaded.

  • JavaScript Minifier

    Shrink a script the same way, with the same check that the result still matches your code.

  • SVG Compressor

    Shrink SVG files or pasted markup, and strip any scripts hiding inside them.

  • PNG to WebP Converter

    Convert a batch of images to a lighter format, keeping transparency intact.

Shrink your next stylesheet in seconds

Paste your CSS, press one button, and check the saving for yourself. Nothing travels anywhere and nothing sticks around.

Prefer Denwix on GoogleReview Denwix on Google