TSToolSeta
Developer Tools · Ready

CSS Minifier

Remove CSS comments and excess whitespace while preserving strings.

Workbench online
Loading tool controls…

CSS Minifier guide

Reduce CSS file size by removing ordinary comments and unnecessary whitespace while preserving quoted strings and important license comments.

What this tool does

The CSS Minifier scans stylesheet text one character at a time. Outside quoted strings, it removes standard /* comment */ blocks, collapses repeated whitespace, tightens common punctuation, and removes the final semicolon before a closing brace. Comments beginning with /*! are preserved because projects often use that form for license or attribution notices. Quoted text and escaped characters are carried through without interpreting their content, which helps protect data URLs, generated content, and strings containing punctuation.

The result includes the original and minified character counts plus an estimated percentage reduction. You can copy the output or download a .min.css file. The original text is processed only in the browser.

This is a focused minifier, not a complete CSS compiler. It does not combine duplicate rules, rewrite colors, calculate shorthands, add vendor prefixes, resolve imports, lint selectors, or build source maps. Modern syntax, unusual escaping, and preprocessing languages such as Sass or Less should be handled by a mature project build tool. Always test the result in the browsers your site supports.

How to use it

  1. Paste plain CSS, not Sass, Less, or another preprocessor source.
  2. Keep required legal notices in /*! important comment */ form.
  3. Select Minify CSS.
  4. Compare the before and after character counts.
  5. Test the output on a staging page, then copy or download it.

If a stylesheet is generated by a framework or bundler, use that toolchain's production optimization whenever possible. It understands the complete build graph and can usually provide source maps and stronger compatibility checks.

Benefits

  • Removes ordinary block comments and excess whitespace
  • Preserves strings, escape sequences, and /*! notices
  • Reports output size and estimated reduction
  • Copies or downloads the final stylesheet
  • Requires no account, upload, or server process
  • Works well for small standalone CSS snippets

Verification matters

Minification should not replace validation. Open the affected interface at several viewport sizes, check hover and focus states, and inspect the browser console for parsing warnings. Keep the original source under version control rather than editing only the minified file. The estimated reduction measures characters, not the final gzip or Brotli transfer size.

FAQ

Yes. Block comments that begin with /*! are retained, while ordinary block comments are removed.

No. Compile preprocessor source into valid CSS first, then minify the resulting stylesheet.

No. It detects unclosed comments and quoted strings, but it is not a standards validator or full parser.

It is a character-count estimate. Actual transfer savings depend on HTTP compression, caching, and the surrounding bundle.

No. Scanning, minification, copying, and download creation all happen locally in your browser.

Keep working

Related tools

View all Developer Tools