CSS Minifier
Compress CSS stylesheets client-side to improve web performance. Strips comments, collapses spacing, shortens 0px to 0, and shows how much smaller the file gets.
Your text 490 chars · 28 lines
Result 490 B → 352 B (28% smaller)
How to use CSS Minifier
- Paste your CSS.
- Choose which optimizations to apply.
- The minified CSS and the size saving update as you type.
- Copy or download the result.
About CSS Minifier
Minify CSS by removing comments and extra whitespace and shortening zero values, and see the size saving as you type. Spaces that CSS needs, such as inside calc(), are preserved so your styles keep working.
Related tools: JSON Formatter & Validator, Base64 Encoder / Decoder, URL Encoder / Decoder, JWT Decoder
What the minifier changes
Comments are removed, whitespace around braces, colons, semicolons, and commas is collapsed, and the last semicolon in each rule is dropped. Zero values with units, such as 0px and 0em, become 0.
Values that only look like zeros are left alone: 10px, 1.0px, and percentage keyframe selectors like 0% are not touched. Spaces around + and - in calc() are kept because CSS requires them.
What it does not do
It does not merge duplicate rules, reorder properties, or rewrite colors. Those optimizations can change how styles cascade, so they are best left to a build tool that understands your whole project.
Custom properties, media queries, and @keyframes pass through unchanged apart from whitespace.
Common uses
- Small sites
- Minify a hand-written stylesheet before uploading it.
- Inline styles
- Compact CSS before putting it in a <style> tag or email template.
- Third-party embeds
- Shrink CSS for widgets and snippets you distribute.
- Checking savings
- See how much of a stylesheet is comments and whitespace.
Questions about CSS Minifier
- Does this CSS minifier handle CSS variables and media queries?
- Yes, all modern CSS syntax including custom properties (--var), @media queries, and keyframes are safely preserved.
- Is minified CSS harder to debug?
- Yes. Keep the original for editing and only deploy the minified version.
- Is my CSS uploaded?
- No. Minifying happens in your browser.
- Why is calc() not fully compressed?
- CSS requires spaces around + and - inside calc(), so those spaces are kept on purpose.
- How much smaller will my CSS get?
- Typically 15 to 40 percent, depending on how many comments and how much indentation the original has.
Comments
Questions, ideas, or a bug in CSS Minifier? Let us know.