🎨 CSS Minifier & Formatter
Minify or format CSS code — free online tool
How CSS Minification Works Under the Hood
A CSS minifier strips everything a browser does not need: comments, extra whitespace, newlines, and the final semicolon before each closing brace. It may also shorten hexadecimal colours where the shorthand is mathematically identical, so ffffff becomes fff. It does not rename classes, reorder rules, or merge selectors, because any of those changes could alter the cascade order. Your input is ordinary stylesheet text pasted into the box, and the output is one compact line you can serve directly.
Read the before-and-after byte counts as a rough guide, not a promise. The real saving depends on how comment-heavy and how neatly indented your source was; a file already written on one long line gains almost nothing. Minification never changes how the styles render, so you can compare the two panes character by character. Keep your readable original in version control and minify only the production copy, so you can always reformat later.
When to Format CSS Instead of Minifying It
The format button performs the reverse transformation, inserting a newline and consistent indentation after each declaration and brace. This helps when you inherit a stylesheet whose rules all sit on one line, or when you copy CSS from a browser inspector. Formatting is purely cosmetic and safe. It cannot repair a missing brace or a typo, so if the result looks broken the source was already invalid. Review the tidy version, then minify again before deployment.
Reach for the minifier when you want a smaller file for faster transfer; reach for the formatter when you need to read or edit. Neither removes unused selectors, adds vendor prefixes, or checks browser support. For those jobs use a build pipeline such as PostCSS with autoprefixer or a purging step, and run this minifier last so nothing re-expands your work. Remember that gzip and Brotli already shrink repeated text, which is why minification works best alongside server compression rather than instead of it.
📖 Usage Guide
Free CSS Minifier & Formatter. Paste CSS code and get a minified or formatted version instantly. Runs entirely in your browser.
Ideal for web developers. Minification reduces CSS file size by 30-60%, improving site speed. Every byte matters for performance.
Format organizes messy code with proper indentation. Perfect for working with unorganized code from multiple sources.
Shows size statistics before and after. Minify button for compression, Format button for readability — one click each.
Tip: Minify before uploading to server. Format when reading code. Neither changes how the code works.
❓ Frequently Asked Questions
Answers to the most common questions
🔗 Share this tool
Share this free tool with friends — no signup required