developer-tools
CSS Minifier
Minify CSS online with conservative comment, indentation, and safe punctuation cleanup while preserving strings, URLs, calc(), and protected comments.
Tool workspace
The interactive tool requires JavaScript.
Instructions
2. Click “Minify CSS” to generate a conservative browser-local result.
3. Review calc(), custom properties, license comments, compatibility patterns, and the target build flow before copying the output.
Paste a CSS fragment or stylesheet and generate compact output for documentation examples, inline styles, theme snippets, or pre-publish review. Processing stays in your browser and no external resources are requested.
A CSS Minifier should remove only layout whitespace and ordinary comments that do not change CSS meaning. This tool uses a conservative strategy: it preserves strings, url() content, spaces around calc() plus and minus operators, custom-property values, and /*! protected comments, while checking comments, quotes, brackets, parentheses, and braces before returning output.
What this CSS Minifier changes
The tool removes ordinary CSS comments, compacts line breaks and indentation, trims whitespace around safe declaration punctuation, and removes unnecessary semicolons before closing braces. It does not load resources, inspect pages, execute scripts, call build tools, or upload input.
Why the minifying is conservative
CSS strings, url(), calc(), attribute selectors, custom properties, and license comments can depend on specific tokens or spacing. Conservative minifying prioritizes valid CSS over aggressive byte shaving.
What to review after minifying
If your CSS includes PostCSS, Sass, Less, browser hacks, source map comments, license text, CSS variables, or complex functions, test the result in the target build and browser environment. This tool is not a complete build pipeline, compatibility audit, or performance conclusion.