CSS Minifier

Compress CSS to reduce file size.

What this does to your stylesheet

It removes comments and collapses whitespace around selectors, braces and property separators. For anything beyond a quick one-off - production builds, especially large stylesheets - a proper build tool (like the minifier built into most modern bundlers) will do a more thorough job, including removing unused rules. Keep your original, readable CSS file as the source of truth either way.

Why whitespace and comments make up most of an unminified file's size

Indentation, line breaks, and comments exist purely to help a human read the file - a browser's CSS parser needs none of them, so stripping them out shrinks the file without changing what it actually does, which is why this kind of whitespace-only minification is both safe and effective as a first pass.

Why this intentionally stops short of what a full build tool does

A production-grade minifier can also merge duplicate rules, shorten color values, and remove selectors that don't match anything in your actual HTML - but that last step specifically requires analyzing your HTML and JavaScript alongside the CSS, which is a much bigger task than a simple paste-and-minify tool can safely attempt, since getting it wrong could silently break your page's styling.

Why keeping the original readable file matters even after minifying

A minified stylesheet with no line breaks or comments is effectively unreadable for future edits - treating the minified output as a build artifact for production, while always editing and maintaining the original readable version, is the same workflow any proper build pipeline follows automatically.

Perguntas frequentes

Will this remove unused CSS rules?

No - it only strips whitespace and comments. Removing unused rules safely requires analysing the HTML/JS that uses the CSS, which this simple tool does not attempt.

Is it safe to only keep the minified version of my CSS?

No - keep your original, readable CSS as the source of truth for future edits, and treat the minified output as something you regenerate for production rather than edit directly.

Why does minifying shrink the file without changing how it looks?

Comments and whitespace exist only to help humans read the code - a browser's parser ignores them entirely, so removing them has no effect on how the page renders.

How much smaller will my file get?

It depends on how much whitespace and how many comments the original has - the tool shows the percentage and character count saved after each run, which varies widely by file.

Should I use this instead of my build tool's minifier for production?

For a quick one-off, this is fine - for actual production builds, a proper build-tool minifier does more (like removing unused rules) and is generally the better choice.

Mais em Technical SEO & Site Management