Minify CSS, or make it readable again

Strip comments and whitespace from CSS to make it smaller, or lay minified CSS out one rule per block. Strings and url() values are never touched.

Smaller or tidier CSS, without the risk of a broken string

CSS written for people is full of indentation, line breaks and comments that the browser does not need. Minifying removes them, so the file downloads faster. Beautifying does the reverse for a minified file you need to read.

The tool reads the CSS as tokens before changing it. A string such as content: "a ; b", a url() with spaces in it, and a comment are each recognised as a unit first, so nothing inside them is altered. Simple minifiers work on characters and will happily remove the double slash from a URL or the spaces inside a quoted font name, which produces CSS that looks fine and renders differently.

What minifying removes

Comments, except those that start with /*!, the convention for licence notices. Line breaks and indentation. Spaces around braces, colons, semicolons, commas and the selector combinators >, + and ~. The last semicolon in each block. Spaces that separate two values, as in margin: 0 auto, stay, because removing them would change the value, and so does the space after and in a media query.

It does not rewrite your CSS. Colours are not shortened, selectors are not merged and rules are not reordered. Those optimisations can change which declaration wins the cascade, and a bundler that sees every stylesheet in the project is the right place to make them. The result line tells you the size before and after, so you know what you saved.

Making CSS readable

Choose Readable and every rule opens its own block, each declaration sits on its own line indented by two spaces, a colon is followed by a space, and rules inside a media query are indented one level further. Comments stay where they were. This is the quickest way to read the stylesheet of a page you are debugging.

For other formats, the JSON formatter and SQL formatter work the same way. Everything here runs in your browser, so stylesheets from a project that is not public yet are never uploaded.

How to minify CSS

  1. 1

    Paste your CSS

  2. 2

    Choose minified or readable

  3. 3

    Copy or download the result

Everything you need

Token-aware

Strings, url() values and comments are recognised before anything is removed, so a semicolon inside content text stays where it is.

Shows the saving

The result line gives the size before and after in bytes and the percentage saved, so you can see whether it was worth doing.

Both directions

Minify for production, or turn a minified file back into one declaration per line to read or debug it.

Nothing is uploaded, and you can verify it

Processing runs on this device. Open the browser’s Network panel while the tool works and you will see no file upload request to FileGizmo. Temporary previews use local browser URLs, and closing or resetting the page releases them instead of leaving a server copy behind.

No daily limits, no watermarks

Use the tool without a daily task counter, account wall or watermark. Nothing is uploaded, so your device’s memory sets the practical size. Free limits a few repeat-work features, such as 20 images per background batch.

Works on any device, and offline after first load

Use a current browser on desktop, Android, iPhone, or iPad without installing an app. Once this tool and its required assets load, the cached workflow works without a connection. Large jobs are usually more comfortable on a desktop with additional memory.

Frequently asked questions

Can minifying break my CSS?

Not the way this does it. Only whitespace and comments are removed, and only where the syntax allows. Strings, url() values and the space a media query needs after "and" are kept exactly.

Are licence comments kept?

Yes. A comment that starts with /*! is kept, which is the convention libraries use to ask for their licence to survive minification. Every other comment is removed.

Does it rename or merge rules?

No. It does not shorten colours, merge selectors or reorder anything. Those changes can alter which rule wins, and a build tool that sees the whole project is the right place for them.

Can it make minified CSS readable?

Yes. Choose Readable and every rule gets its own block, every declaration its own line, and nested at-rules such as media queries are indented.

Related guides

Format SQL, minify CSS and read bytes without breaking anythingWhy formatters and minifiers break working code, how strings, comments and UTF-8 bytes trip them up, and how to tidy code without pasting it into a server.