Menu
PDF Tools
Image Tools
Converters & Utilities
Seller & Print Tools
Accounting & Business
Calculators
Text & Writing Tools
Developer & Web Tools
Creator & Social Tools
Browser Utilities & Games
Document & Design Makers
Text & Developer Tools
Exam & Form Tools

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.

How to use CSS Minifier online

  1. Paste the CSS. Type or paste your stylesheet.
  2. Read the result. The minified CSS appears with the bytes saved.
  3. Test the page. Load the minified file and check the page looks the same.
  4. 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?
It should not. Only spacing and comments are removed.
Are strings and urls kept?
Yes, exactly as typed.
Is the space in calc() kept?
Yes, because calc needs it around plus and minus.
Does it shorten colours?
No. It is a light minifier.
How do I read minified CSS?
Use the CSS beautifier.
Is the CSS Minifier private?
No copy is made on a server; the CSS Minifier runs in your browser.
How do I keep the result of the CSS Minifier?
Copy the CSS Minifier result, or save it as a text file from the result box.

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.

More tools in Text & Writing Tools →

Search tools