Skip to content
Toolew.com

CSS Minifier

Strip comments and non-essential whitespace from CSS with a lightweight, dependency-free minifier, entirely in your browser.

Runs in your browser. Your data is not uploaded.
Loading tool…

This guide is not yet available in your language and is shown in English.

Tool guide

What this tool does

CSS Minifier removes comments and collapses non-essential whitespace around selectors, braces, colons and commas, a safe, conservative minification that reduces file size without rewriting values or merging rules, all computed locally with no library dependency.

Shrinking a CSS file’s size for faster page loads usually happens automatically in a build pipeline, but for a quick one-off snippet, pasting it through a minifier directly is faster than setting up tooling.

This tool strips comments and collapses whitespace around selectors, braces, colons and commas, a safe, conservative minification that reduces size without rewriting colour values, merging duplicate rules, or other more aggressive optimisations a full build-tool minifier might attempt.

How to use CSS Minifier

  1. Paste your CSS.
  2. Review the before/after size comparison.
  3. Copy or download the minified output.
  4. Keep your original, readable source for future edits.

Tips for better results

  • This is a conservative, safe minification, it won’t rewrite colour values (like #ffffff to #fff) or merge duplicate selectors the way a more aggressive dedicated build-tool minifier (like cssnano) would.
  • Minified CSS is harder to read or debug directly, keep your original, formatted source as the file you actually edit, and minify only the final output for production.
  • For most real projects, CSS minification happens automatically as part of a build pipeline (Vite, webpack, etc.); this tool is most useful for a quick one-off snippet or inline <style> block.
  • The percentage reduction shown gives a quick sense of how much comments and formatting whitespace were contributing to the file’s size, versus the actual rules themselves.

Common use cases

  • Quickly minifying a small CSS snippet or inline <style> block without setting up build tooling.
  • Reducing the size of CSS pasted into a context with a character limit.
  • Stripping comments from CSS before sharing it publicly.
  • Checking how much of a stylesheet’s size comes from comments and formatting versus actual rules.

Common mistakes to avoid

  • Editing the minified output directly going forward; keep your original, readable source as the file you actually maintain, and re-minify from that each time instead of working from compressed code.
  • Expecting colour value shortening (#ffffff to #fff) or duplicate rule merging; this minifier is intentionally conservative and only strips comments and non-essential whitespace, not more aggressive rewrites.
  • Minifying CSS that still has unresolved syntax errors; a minifier doesn’t validate or fix invalid CSS, it only compresses whatever you give it, errors in the source will persist in the minified output.

Frequently asked questions

Does this rewrite colour values or merge rules?

No, this is intentionally a conservative minifier, it only removes comments and collapses non-essential whitespace, more aggressive optimisations like colour shortening or rule merging aren’t performed.

Should I edit the minified output directly?

No, keep your original, readable CSS as the source you actually maintain and edit; minify only when you need the final compressed output, re-minifying from the readable source each time.

Does this check my CSS for syntax errors?

No, it only compresses whatever text you provide; it doesn’t validate or parse the CSS for correctness, any existing syntax errors will persist unchanged in the output.

Is my CSS uploaded anywhere?

No, minification happens entirely in your browser using plain string operations; nothing is transmitted anywhere.

Feedback & suggestions

Help us improve CSS Minifier. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.