Skip to content
TypeParser
All tools

CSS Minifier

Minify CSS, drop comments and whitespace.

beats cssminifier.com edge: Zero-unit cleanup + savings report
input.css
paste CSS
Guide

About CSS Minifier

Compact CSS for production. Drops comments, whitespace, last semicolons in rule blocks. Optional zero-unit cleanup (<code>0px</code> → <code>0</code>) and shorthand collapse (<code>margin: 1px 1px 1px 1px</code> → <code>margin: 1px</code>). Reports byte savings.

When to minify CSS

Your build tool likely already does it (Vite, Astro, Next, esbuild — all minify in production). Reach for this manually when:

  • Optimizing a small inline <style> block
  • Hand-optimizing a critical CSS extract
  • Quickly seeing how much your CSS shrinks
  • Compacting a third-party stylesheet for embed

Common workflows

Inline critical CSS. Minify the above-the-fold styles, embed in <head>. Saves a render-blocking request.

Audit gzip ratio. Minify → gzip mental model. Well-written CSS gzips to ~25% of source; minify shaves another 10% before gzip applies.

Compact a vendor stylesheet. Embedded CSS from a third-party widget often arrives unminified. Compact before embed.

Frequently asked questions

Will it break my CSS?
Comments and whitespace stripping is safe. Zero-unit cleanup is mostly safe (skipped inside calc and certain functions). Shorthand collapse is conservative.
How much savings?
Typically 25-50% reduction. Highly commented CSS saves more.
Will it sort or rename?
No. Selector and property order is preserved. Identifier names stay (CSS does not have a concept of "private" identifiers to mangle).
Custom properties?
Untouched. --color-accent stays as --color-accent.
For Tailwind output?
Tailwind already minifies in production builds. The tool here is for hand-rolled CSS.
For SCSS / LESS?
Compile first to plain CSS, then minify. The tool does not handle preprocessor syntax.

Related tools

Last updated: 2025-01-15