CSS Minifier
Remove CSS comments, redundant whitespace and empty rules.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Reduced 33 to 14 characters of CSS.
How it works
- Removed comments, keeping /*! licence comments.
- Removed whitespace around braces, colons, semicolons, commas and combinators.
- Dropped the final semicolon in each block.
- Strings and url() values are copied exactly, so values that need spaces stay valid.
- Minifying the result again changes nothing.
Methodology
- Tokenise the stylesheet, treating strings and comments as opaque.
- Remove comments unless disabled, preserving /*! licence comments.
- Collapse whitespace around structural punctuation and drop the final semicolon in a block.
Usage
- Paste or type a CSS stylesheet.
- Choose whether to remove comments.
- Run the minifier and copy the smaller stylesheet.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Whitespace and comments removed
{
"text": ".a {\n color: #fff; /* note */\n}\n",
"removeComments": true
}Licence comment kept
{
"text": "/*! (c) me */ .a { color: red; }",
"removeComments": true
}Calc spacing preserved
{
"text": ".a { width: calc(100% - 10px); }",
"removeComments": true
}Limitations
Smaller stylesheets
Removing comments and structural whitespace shrinks a stylesheet without changing any declaration. Values that require spaces are detected and preserved.
Frequently asked questions
- Can minifying break calc()?
- No. Whitespace that is required inside values is preserved; only whitespace around structural punctuation is removed.
- Are licence comments kept?
- Yes. Comments beginning with /*! are preserved so required notices survive.
- Is my stylesheet uploaded?
- No. The stylesheet is processed entirely in your browser.
Sources
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.