CSS Minifier
This tool minifies CSS. It removes comments, spaces and line breaks and the last semicolon of each rule, and shows the bytes saved.
- Free, no sign-up
- Nothing is sent to a server
- Worldwide
How to use CSS Minifier online
- Paste the CSS. Type or paste your stylesheet.
- Read the result. The minified CSS appears with the bytes saved.
- Test the page. Load the minified file and check the page looks the same.
- Copy it. Copy or save the result.
Why use this free CSS Minifier
- Comments and spaces removed
- Strings and urls kept
- calc() spacing kept
- Bytes saved shown
- Last semicolon dropped
- Share by link
Why minify CSS
Stylesheets are written with comments and spacing so people can read them. A browser does not need them. Minified CSS is smaller, so it downloads faster and uses less data. Smaller pages help visitors on slow connections and are a small part of a fast site.
What the minifier does
It removes comments, turns runs of white space into nothing or a single space where one is needed, and takes out the space around braces, colons, semicolons, commas and combinators. The last semicolon before a closing brace is dropped. Strings and url() addresses are kept exactly, and the space inside calc() expressions is kept, since it matters there.
A worked example
The sample stylesheet is 114 bytes with a comment, indentation and blank lines. Minified, it reads .title{color:#ff0000;margin:0 auto}.a>.b,.c{background:url("x.png") no-repeat} and is 78 bytes, a saving of 31.6%.
What it does not do
This is a safe, light minifier. It does not shorten colours, merge rules, drop unused rules or change values, which more advanced tools do. Those steps can save more, but they can also break a style if they go wrong. Test your pages after you replace a file with its minified version.
Keep the original
Keep your readable source and publish the minified copy, since minified CSS is hard to edit. The CSS beautifier can turn minified code back into a readable layout when you only have the compressed file. A server that compresses responses with gzip or brotli gives an extra saving on top of minifying.
Using the tool
Change the text or any option of the CSS Minifier and the answer moves straight away. Find and replace is built into the editor with Ctrl+F and Ctrl+H.
CSS Minifier: frequently asked questions
Does minifying change how a page looks?
Are strings and urls kept?
Is the space in calc() kept?
Does it shorten colours?
How do I read minified CSS?
Is the CSS Minifier private?
How do I keep the result of the CSS Minifier?
Related searches for CSS Minifier
- CSS Minifier online
- free CSS Minifier
- CSS Minifier online free
- CSS Minifier for mobile
- CSS Minifier without sign up
- CSS Minifier – Text & Writing Tools
CSS Minifier is a free online tool on MAITBOX, in the Text & Writing Tools group. It runs in your browser, so what you type is not sent to a server. It works on Android and iPhone, and on Windows, Mac and Linux, with no download and no account.