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
- Paste plain CSS, not Sass, Less, or another preprocessor source.
- Keep required legal notices in
/*! important comment */form. - Select Minify CSS.
- Compare the before and after character counts.
- 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.