CSSNew

CSS Minifier with Before and After Byte Counts

Minify CSS by removing whitespace and comments

100% client-side — your data never leaves your browserNo data stored or uploadedFree for lifetime · No signup

What is a CSS minifier?

A CSS minifier strips everything a browser doesn't need to render your stylesheet: comments, indentation, line breaks, and redundant spaces around selectors and property values. None of that whitespace changes how the CSS behaves, but it does add bytes to every page load — and CSS is render-blocking, so a smaller file means the browser can build the render tree sooner.

This tool runs the transform entirely in your browser with a regex-based pass — no upload, no build step. Paste a stylesheet and get back the same rules with the formatting removed.

When to use it

Minify CSS before shipping to production when you don't already have a bundler (Vite, webpack, Next.js) doing it for you as part of the build — for example, a static site, an email template, or a `<style>` block injected at runtime. It's also useful when you need to paste CSS into a size-constrained field, such as a CMS custom-CSS box with a character limit, or when you want a quick gut-check on how much dead weight your comments and formatting are adding.

If your project already runs through a bundler, that pipeline typically also does more aggressive optimizations (merging duplicate rules, shortening color values) than this tool's whitespace-only pass — use this for one-off snippets, not as a replacement for a real build pipeline.

Example

Input:

.container { display: flex; /* center items */ align-items: center; }

Output: .container{display:flex;align-items:center} — the comment is gone, and every unnecessary space and the trailing semicolon before the closing brace are stripped, cutting this snippet from 78 bytes to 42.

How to use the CSS Minifier with Before and After Byte Counts tool

  1. 1

    Paste your CSS

    Drop a stylesheet, or a single rule block, into the input panel.

  2. 2

    Click Minify

    Comments, whitespace, and redundant characters are stripped in one pass.

  3. 3

    Check the savings

    The byte counts under the output show original size, minified size, and percent saved.

  4. 4

    Copy or share

    Copy the minified CSS, or copy a permalink that restores your input for anyone who opens it.

Frequently asked questions

Is my CSS uploaded anywhere?

No. Minification runs client-side with a regex-based transform — nothing you paste is sent to a server or logged.

Will this break my CSS?

The transform only removes comments and whitespace that don't affect parsing — it doesn't rename anything or reorder rules, so behavior is preserved. As with any minifier, keep your original source under version control; this tool is for the production output, not for editing.

How is this different from a bundler's CSS minifier?

Build tools like esbuild or Lightning CSS also merge duplicate selectors, shorten hex colors, and drop unreachable rules. This tool only strips whitespace and comments — it's meant for quick, dependency-free minification of a single file or snippet.

Do you also minify JavaScript and HTML?

Yes — see the JS Minifier and HTML Minifier tools for the same whitespace-stripping approach applied to those formats.

Related on TechLogHub

Get the next tool before you need it

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.