CSS Formatter
Format CSS with consistent indentation, spacing and one declaration per line.
Compress a stylesheet down to the bytes that matter.
CSS Minifier removes everything a browser does not need to parse your stylesheet: comments, the whitespace that made it readable, the semicolon before a closing brace, and the leading zero in values like 0.5em.
Several optional passes go further. Hex colours written in full can be shortened when both digits of each pair match, so #ffcc00 becomes #fc0. Zero values can drop their unit, since 0px and 0 are identical. Empty rules, which usually arrive from a deleted declaration nobody tidied up after, can be removed entirely.
Every transformation here preserves meaning exactly. The tool does not merge rules, reorder properties or combine selectors, because those changes depend on cascade order and can alter which rule wins. A smaller file is not worth a layout that silently changes.
Looking for something this does not cover? FreeToolsHub.org is another hub of free online tools that need no account, and it is worth a look if css minifier is only part of what you are working on.
The css minifier is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:
Yes. Every change made here is one the CSS specification treats as equivalent, so the browser parses it to exactly the same rules.
Because the cascade depends on order. Two rules with the same selector can both be intentional, and merging them changes which declaration wins. Safe minification means byte-level changes, not structural ones.
Typically twenty to thirty percent for a hand-written stylesheet with comments and indentation. Frameworks that were already compact save far less.
Less than people expect, since compression already handles repeated whitespace well. The real saving comes from removing comments and unused rules, and the latter is a different job entirely.
No. A three-digit hex is expanded by doubling each digit, so the shortening only happens when the full form has matching pairs and the two are genuinely identical.
Use the CSS Formatter to expand it again, though comments are gone for good.
If the css minifier is not quite what you need, these other free tools solve closely related problems, and there are 10 more in code formatters.
Format CSS with consistent indentation, spacing and one declaration per line.
Shrink HTML by removing comments and collapsing whitespace, safely.
Shrink JavaScript by removing comments and whitespace, without renaming anything.
Compress and resize JPEG, PNG and WebP images privately in your browser.
Design linear and radial gradients with live preview and copyable CSS.
Checked and rebuilt on 2026-10-14. The method this calculator uses is described in the section above, and corrections go through the contact page.