How to use CSS Minifier
- Paste your stylesheet, including its selectors and declarations.
- Select Minify and check the resulting byte count.
- Copy the output or download it as a .css file, then test it with the page that uses it.
A closer look
CSS minification requires understanding syntax: a space in a selector can select descendants, and spaces around operators can matter in calc(). This tool uses CSSTree to parse and regenerate compact CSS. It removes formatting without reordering rules or making structural optimization assumptions. Custom property values are retained as raw values because they may contain unusual token sequences used later by var(). Strings, URLs, nested rules, and function syntax are handled by the parser instead of global text replacements.
A practical example
Minify p { color: red; } to a compact rule such as p{color:red}. Rule order and meaningful selector spacing are preserved.
A useful tip
This is formatting minification, not a full CSS validator or compatibility checker. Unsupported grammar may be rejected, while unknown property names can be retained. Comments are normally removed, so keep any required license notice separately.
Good questions. Simple answers.
Does it download imports or URLs?
No. Referenced URLs stay as text in the stylesheet. There is no network fetch or stylesheet injection.
Does it remove unused styles?
No. Determining whether a selector is unused requires the consuming application. This tool keeps rule order and does not inspect your website.
Explore all developer tools for related tasks and category-specific guidance, or read how Toolzafi handles your data.