FlipMyFormat

CSS Minifier

A CSS minifier that works in your browser: comments and spaces removed safely, values shortened, empty rules dropped, sizes shown before and after gzip. Switch to Beautify to turn compressed code back into readable lines. Nothing is uploaded.

Original

322 B

Minified

244 B

Saved

24%

With gzip

…

Your CSS

Result

Optimise

Comments

All other comments are removed.

Several files

Open several CSS files to join them into one, in the order you pick them.

Minified in your browser as you type. Your code is not uploaded.

People also use

How to use the CSS minifier tool in three steps

Paste a stylesheet into the Your CSS box and the minified result appears on the right as you type. Above the boxes, four figures show the original size, the minified size, the percentage saved and the size of both versions after gzip. Copy the result, or download it as a .min.css file.

This CSS minifier does the safe, predictable work: it removes comments and spaces, drops the last semicolon in each block, shortens values such as 0px, 0.50 and #ffffff, and removes empty rules. Switch Mode to Beautify (unminify) and the same page turns compressed code back into indented, readable lines.

Everything runs in your browser. Your code is not uploaded, so it works the same way for a public theme and for private client work.

  1. 1

    Paste or open your CSS

    Paste into the Your CSS box, or press Open CSS files and pick one or more files. Several files are joined in the order you pick them.

  2. 2

    Choose Minify or Beautify

    Keep Mode on Minify and set Shorten values, Remove empty rules and Keep /*! … */ comments. Or choose Beautify (unminify) and pick 2 spaces, 4 spaces or Tab.

  3. 3

    Copy or download

    Press Copy, or Download to save a .min.css file (a .css file in Beautify mode). The Saved and With gzip figures show what you gained.

The CSS minifier tool remembers your choices for Mode, the options and the indent in this browser for next time. The code you paste is never saved; the page opens with a short sample each time.

What gets smaller: every change, before and after

Browsers do not need the spaces, line breaks and comments that make a stylesheet pleasant to write. Minifying removes them and writes some values in a shorter form that means exactly the same thing. The page looks identical; the file is simply smaller, so it downloads a little faster and takes less room in caches.

The table lists every change this CSS minifier makes. Removing spaces, ordinary comments and the last semicolon always happens, because that is the core of minifying. The other changes each have their own checkbox.

ChangeBeforeAfterSetting
Comments/* Buttons */removedAlways; /*! … */ kept if ticked
Spaces and line breaks.a { color: red; }.a{color:red}Always
Last semicolon in a blockcolor:red;}color:red}Always
Zero with a unitmargin: 0px automargin:0 autoShorten values
Leading and trailing zeros0.50rem 1.0rem.5rem 1remShorten values
Hex colours#FFFFFF #2563EB#fff #2563ebShorten values
Font weight keywordsfont-weight: boldfont-weight:700Shorten values
Empty rules.unused {}removedRemove empty rules

Zero values keep their unit inside calc(), where a bare 0 can make the whole expression invalid, and 0% is left as written. font-weight: normal becomes 400. Text inside quotes and inside url() is never touched by any of these changes.

CSS minifier online: paste, watch the numbers, copy

A CSS minifier online should be quicker than opening a terminal, and here there is no button to press: the result updates as you type or paste. That makes it handy for a one-off file, a snippet for the custom CSS box of a website builder, an email template, or a quick look at how much a stylesheet would shrink.

The Saved figure is the share of bytes removed, measured in UTF-8 just as a server would send them. Hand-written code with comments and generous indentation shrinks the most. Code that is already compact shrinks much less, and that is normal.

The Clear link empties the box when you want to start over. If the code cannot be read, an error panel replaces the result and tells you the line where the problem starts.

Minify CSS online without breaking your styles

The usual worry when you minify CSS online is that a careless tool joins things that must stay apart. This page reads the code piece by piece first: quoted strings, url() values and comments are set aside before any space is removed. A content value such as " › " keeps its spaces, and a font name in quotes stays exactly as written.

Inside brackets, the spaces that matter are kept. calc(100% - 2rem) needs the spaces around the minus sign, and it keeps them. var(), rgb() and other functions are handled the same way.

Selectors are treated with care too. a:hover and a :hover mean different things (the second matches any hovered element inside a link), so the space before :hover is kept. Spaces around >, + and ~ and after commas are removed, because they never change the meaning.

One small change you may notice: the space before !important goes, so color: red !important becomes color:red!important. Browsers read both the same way.

CSS minifier free of accounts, limits and uploads

The page is a CSS minifier free to use as often as you like: no account, no daily limit, and nothing added to your output, not even a banner comment. What you copy is your own code, only smaller.

Because the work happens on your device, the practical limit is your device itself. Typical stylesheets update as you type; a very large file may take a moment on an older phone.

CSS minifier and compressor: what gzip adds

People often say minifier and compressor as if they were the same thing, but they are two separate steps. Minifying rewrites the code itself. Compression, such as gzip or Brotli, is done by the web server when it sends the file, and the browser unpacks it. A good setup uses both, and this CSS minifier and compressor view shows both results side by side.

The With gzip figure is measured in your browser with the built-in CompressionStream feature. It compresses the original and the result and shows the two sizes as original → minified.

You will notice that gzip shrinks the original a lot by itself, and that the gap after gzip is smaller than the Saved percentage suggests. That is expected, because gzip is very good at squeezing repeated spaces. Minifying still helps: the browser has fewer bytes to download and read, and comments meant for developers stay out of production.

The page cannot switch on gzip or Brotli for your site; that is a setting on your web server, host or CDN. If your browser does not support CompressionStream, the With gzip box shows dots instead of numbers, and the minified result is not affected.

Minify CSS file by file, or join several into one

To minify CSS file by file from your computer, press Open CSS files and pick a .css file. It loads into the box, and the Download button names the result after it, so theme.css is saved as theme.min.css.

Pick several files at once and they are joined into one, in the order you picked them. With Mark where each file starts when joining ticked, a comment with the file name is placed before each file in the Your CSS box, so you can see where one ends and the next begins, and match an error line to the right file. These markers are ordinary comments, so they are removed from the result. A joined result downloads as styles.min.css.

Joining is useful for small sites that load several stylesheets: one request instead of several. Keep the same order as in your HTML, because when two rules have the same specificity, the later one wins.

The picker also accepts .scss and .less files, but they are read as plain CSS. Sass and Less features such as // comments, variables and mixins are not compiled, so compile them to CSS first and minify the output.

CSS compressor online or a build tool?

A css compressor online is the right choice for quick, one-off jobs: a stylesheet for a landing page, code pasted into a website builder, a theme file you edit by hand, or a check before you send code to a client.

For a site you deploy often, put minification in your build instead, so it happens every time without copying and pasting. Bundlers and CSS build tools can minify as part of the build, and they can also do the deeper work described further down this page, because they see your whole project.

Both approaches are fine. Use this page when it saves you time, and use a build step when the same file changes every day.

CSS beautifier online: readable code with your indent

Switch Mode to Beautify (unminify) and the page works as a css beautifier online: each rule gets its own block, each declaration its own line, and blocks inside @media are indented one level deeper.

Under Indent, choose 2 spaces, 4 spaces or Tab to match your editor or your team's style. A selector list such as .button:hover,.button:focus is split so that each selector sits on its own line, and a blank line separates top-level rules.

Beautify does not change your values. It does not shorten colours or zeros, and it does not undo shortening either. Use it to read and edit code, then switch back to Minify when you are done.

CSS unminify: what comes back and what does not

A css unminify step puts the line breaks and indentation back so a person can read the code. That part works fully: the selectors, declarations and @media blocks come back in a clean, consistent layout.

What cannot come back is anything the original minifier threw away. Removed comments are gone for good, personal formatting such as aligned values is lost, and if a build tool merged or reordered rules, they stay that way. Beautify itself keeps only /*! comments and removes any other comments it finds.

If you need the original source with its comments, look for an unminified file next to the minified one, often with the same name without .min, or ask whoever built it for the source.

CSS minify to normal when debugging a live site

Turning css minify to normal, readable code is mostly a debugging job. You find a style problem on a live site, open its stylesheet and see one endless line. Paste it here in Beautify mode, and you can search it, read it and find the rule you need.

To see what changed between two versions of a stylesheet, beautify both with the same indent and compare them in the Diff Checker. Because the layout is identical, only real changes show up.

Browser developer tools can also pretty-print a stylesheet, but a beautified copy that you can paste, keep and compare is often handier.

What this page does not do

This CSS minifier is careful, not a full optimiser. The jobs below are left to build tools, which can see your HTML, scripts and settings:

  • Merging rules: two rules with the same selector, or with the same declarations, are not combined, and shorthand properties are not built from separate longhands.
  • Removing unused CSS: the page cannot see your HTML or JavaScript, so it cannot know which selectors are used. Tools that scan your templates do that.
  • Adding vendor prefixes: no -webkit- or -moz- lines are added. An autoprefixing step in your build adds them based on the browsers you support.
  • Minifying JavaScript or HTML: this page handles stylesheets only. Bundlers include a JavaScript minifier for scripts.
  • Compiling Sass or Less, and writing source maps.

Error messages: finding the broken line

Before minifying, the CSS minifier checks the structure and stops with a clear message instead of producing broken output. The message takes the place of the result and starts with the line number, such as Line 12.

MessageWhat it meansHow to fix it
A comment is never closed with */.A /* starts a comment that never ends, so the rest of the file would vanish.Add */ where the comment should end.
A string is never closed.A quote opens a string that runs to the end of the line.Add the missing quote on the line shown.
url( is never closed.An unquoted url( has no closing bracket.Add ) after the address.
This } has no matching {.There is one closing brace too many.Delete the extra } or add the missing {.
1 { is never closed.A block is missing its }. The line shown is the last line of your code.Look above for the rule that has no closing brace.

When several files are joined, the file name markers in the Your CSS box help you see which file the reported line belongs to.

Troubleshooting: when the result is not what you expected

The page looks different after minifying

Check whether the original relied on a comment hack or on invalid code the browser was ignoring. Beautify the original and the result and compare them in the Diff Checker to see exactly what changed.

My license comment disappeared

Only comments that start with /*! are kept, and only when Keep /*! … */ comments is ticked. Change /* to /*! at the start of the license comment.

Saved shows a small number

The code was already compact. Minifying cannot remove much from a file that has few comments or spaces left.

With gzip shows only dots

Your browser does not support the CompressionStream feature used to measure gzip. The minified result is still correct.

Sass or Less code breaks

// comments, variables and mixins are Sass and Less features, not plain CSS. Compile to CSS first, then minify.

Colours look different in a code review

Shorten values writes hex colours in lowercase, and in three or four digits where possible. #FFFFFF and #fff are the same colour. Untick Shorten values to keep them as written.

An empty rule I need was removed

Some scripts add styles to an empty placeholder rule. Untick Remove empty rules to keep it.

The download is called styles.min.css

When several files are joined, the result is named styles. With one file, it takes that file's name.

All settings at a glance

SettingChoicesWhat it does
ModeMinify / Beautify (unminify)Make the code as small as possible, or format it for reading.
Shorten valuesOn / off (Minify)0px → 0, 0.50 → .5, 1.0 → 1, #ffffff → #fff, font-weight bold → 700 and normal → 400.
Remove empty rulesOn / off (Minify)Drops rules with nothing inside, and @media blocks left empty.
Keep /*! … */ commentsOn / off (Minify)Keeps license comments that start with /*!; all other comments are removed.
Indent2 spaces / 4 spaces / Tab (Beautify)The indentation for each nesting level.
Mark where each file startsOn / offAdds a comment with the file name before each file in the Your CSS box when several are joined.
Open CSS files.css, .scss, .less or textLoads one file, or joins several in the order you pick them.

Is it safe? Your code stays in your browser

The CSS minifier, the beautifier and the gzip measurement all run inside this page. Your code is not uploaded and not saved; only your settings are remembered in this browser.

That makes the page suitable for code under an NDA, unreleased designs and client themes. You can check it yourself: open your browser's network panel while you paste, and you will see no request carrying your code.

What to do next

Working with other front-end files? The JSON Formatter tidies and checks JSON config files, and the Diff Checker compares two versions of a stylesheet line by line.

Need visuals for your styles? The Gradient Generator helps you build gradient backgrounds, Compress Image makes background images and photos smaller, and the Favicon Generator makes the small icons your HTML links to.

Frequently asked questions

How do I use this CSS minifier online?

Paste your code into the Your CSS box, or press Open CSS files. The minified result appears on the right as you type, with the size saved shown above. Press Copy or Download when you are happy with it.

Is this CSS minifier free?

Yes. There is no account, no daily limit and nothing added to your output. The work runs on your own device, so there is no server cost to pass on.

What is the difference between a CSS minifier and compressor?

A minifier rewrites the code to remove comments, spaces and longer value forms. A compressor such as gzip packs the file when the server sends it, and the browser unpacks it. They work together, and the With gzip figure shows the effect of both.

How do I change css minify to normal, readable code?

Switch Mode to Beautify (unminify) and paste the minified code. Each declaration goes on its own line, indented with 2 spaces, 4 spaces or a Tab, as you choose under Indent.

Is it safe to minify CSS online with private code?

Yes, on this page. The code is processed inside your browser and never uploaded or saved. Only your settings, such as Mode and Indent, are remembered in this browser.

Is a css compressor online as good as a build tool?

For removing spaces, comments and long value forms, yes. Build tools can go further, such as removing unused rules, merging rules and adding prefixes, and they run automatically on every deploy. Use the page for quick jobs and a build step for daily work.

Does it also work as a css beautifier online?

Yes. Choose Beautify (unminify) under Mode. Each rule gets its own block and each declaration its own line, and you can download the result as a .css file.

Can a css unminify step bring back the comments?

No. Once a comment is removed, it is gone; beautifying only restores line breaks and indentation. Only comments that start with /*! survive, and only if they were kept when the file was minified.

Can I minify CSS file by file or several at once?

Both. Open one file and the download is named after it, such as theme.min.css. Open several and they are joined in the order you picked them, with optional markers showing where each file starts.

What does the CSS minifier tool change in my code?

It removes comments, spaces, line breaks and the last semicolon in each block. With Shorten values on, it writes 0px as 0, 0.50 as .5, 1.0 as 1, #ffffff as #fff, and font-weight bold and normal as 700 and 400. With Remove empty rules on, it drops rules with nothing inside.

Will minifying break my styles?

It should not. Strings, url() values and the inside of calc() and var() keep the spaces they need, and selector spaces that change the meaning, such as in a :hover, are kept. If the code has an unclosed brace, string or comment, you get an error with a line number instead of a broken result.

Does it remove unused CSS?

No. To know which selectors are unused, a tool must scan your HTML and scripts, which this page cannot see. Build tools that read your templates do that job.

Does it merge duplicate rules?

No. Rules are kept in their original order and are not combined, and shorthand properties are not built from longhands. This keeps the result predictable.

Does it add vendor prefixes?

No. Nothing is added to your code. An autoprefixing step in your build adds -webkit- and similar prefixes based on the browsers you support.

Can it minify JavaScript or HTML?

No, this page handles stylesheets only. Script files need a JavaScript minifier, which most bundlers include.

Why is my /*! comment kept but other comments removed?

Comments that start with /*! are the usual way to mark license and copyright notices that must stay in the file. With Keep /*! … */ comments ticked they are kept; untick it to remove them too.

Why does 0px become 0 but not inside calc()?

Outside calc(), a zero length needs no unit. Inside calc(), a bare 0 can make the expression invalid, so the unit is kept there. 0% is also left as written.

What does the With gzip figure mean?

It shows the size of the original and of the result after gzip compression, measured in your browser. That is close to what a server with gzip turned on would send. If your browser cannot measure it, you see dots instead.

What do the error messages with line numbers mean?

The page found an unclosed comment, string, url( or brace, or a closing brace with no opening one. The message tells you the line to check. For a missing closing brace, the line shown is the last line, so look above it.

Can I use it for Sass or Less files?

You can open .scss and .less files, but they are read as plain CSS. Features such as // comments, variables and mixins are not compiled, so compile to CSS first.

Is my code saved or uploaded?

Neither. The code stays in the page while you work and is gone when you close it. The page opens with a short sample next time; only your settings are remembered.

Use the CSS minifier now

Comments and spaces removed safely, values shortened, sizes before and after gzip, and a Beautify mode. Free, private and processed on your device.

Back to the tool

Last updated October 2026 · Written and maintained by the FlipMyFormat team