Frontend ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Frontend Tools

Online CSS Minifier

Minify CSS in your browser: remove comments and whitespace, keep strings, url() values and licence comments, compare byte sizes and download styles.min.css.

View all tools
ResultUpdates as you type

328 bytes → 260 bytes: 68 bytes saved (20.7%). Strings, url() values and spaces inside calc() are left as they were.

/*! Theme v1.2 | MIT licence */.card{color:#202124;margin:0 16px;background:url("data:image/svg+xml;utf8,<svg></svg>")}.card>.title,.card :first-child{font:600 18px / 1.4 "Helvetica Neue",Arial,sans-serif!important}@media (max-width:600px){.card{margin:0 8px}}

Download styles.min.css

How to use Online CSS Minifier

Paste CSS on the left and the minified code and size comparison appear on the right as you type. Licence comments that start with /*! are kept unless you untick the option. Copy the result or download styles.min.css when you are happy with it.

  1. Paste your CSSPaste a stylesheet, including comments, media queries and nested rules.
  2. Check the savingsThe note above the code shows the original and minified sizes in bytes, and warns about unbalanced braces.
  3. Copy or downloadCopy the minified CSS or download styles.min.css, and test it in your project before you deploy.

What is removed and what is kept

The minifier follows the structure of the CSS. It removes ordinary comments, the whitespace around selectors, colons, semicolons, commas, braces and the >, + and ~ combinators, and the last semicolon in each rule. Strings, url() values and the spaces calc() needs around + and - are left alone, and the descendant space in a selector such as div :first-child is kept. The sample shrinks from 328 to 260 bytes, a saving of 68 bytes or 20.7%.

Before you replace your stylesheet

This is safe text minification: it does not merge rules, reorder declarations, remove unused selectors or rewrite colours and numbers. Sizes are counted in UTF-8 bytes, which reflects the real file size better than character counts when the CSS contains non-ASCII text. Keep the readable source under version control, publish the minified file as a build output, and check layouts, hover and focus states and breakpoints after swapping it in.

Accuracy and data handling

After adding generated code to a project, test it in the target browsers and responsive sizes. The calculation runs in your current browser; the tool code does not send the input to a processing API.

Often Used Together

Next step

FAQ

What does the CSS minifier remove?

Ordinary comments, line breaks, unnecessary spaces and the final semicolon in each rule. Comments starting with /*! are kept for licences unless you untick that option.

Can minifying break my CSS?

It only removes whitespace that CSS ignores and never touches strings or url() values. Source that already has syntax errors may behave differently, and the tool warns when the braces do not balance.

Does it merge rules or remove unused CSS?

No. It performs conservative minification and a size comparison only. Use a build tool if you need rule merging or unused-style removal.

Is my CSS uploaded?

No. Minifying, counting bytes and creating the download all happen in your browser.

More Frontend Tools

Related tools