CSS Minifier
Minify and compress CSS stylesheets instantly in your browser. Remove comments, collapse whitespace, and reduce file size. Free and private.
Drag & Drop a CSS file here
Supports .css files. Or paste your CSS above.
Minify and compress CSS stylesheets instantly in your browser. Remove comments, collapse whitespace, and reduce file size. Free and private.
Supports .css files. Or paste your CSS above.
CSS minification removes whitespace, comments, and unnecessary characters from a stylesheet to reduce its size before serving to browsers. The actual rules are unchanged: a minified stylesheet renders pages identically to the unminified source. The savings come from removing newlines, redundant semicolons, comments, hex-color shorthand opportunities, and zero-unit shortcuts (replacing 0px with 0).
On modern websites with dozens of style rules, the typical reduction is 20–40% versus the unminified source. Combined with gzip compression at the server, the marginal savings shrink — gzip already compresses repeated text effectively — but the combination still beats compression alone, particularly when stylesheets are cached and served many times to many visitors.
This minifier processes CSS in a single pass, removing comments outside of url() values, collapsing whitespace, removing redundant semicolons before closing braces, applying zero-unit shorthand, and converting six-digit hex colors to three-digit form where possible (#ffffff → #fff). The output remains valid CSS that any browser parses correctly.
Smaller CSS files load faster and render-blocking time drops, both of which improve First Contentful Paint and Largest Contentful Paint scores. For sites where Core Web Vitals affect search ranking, every kilobyte of render-blocking CSS shaved is worth the effort.
Bandwidth costs also matter at scale. Sites that serve millions of page views save measurable amounts of egress when their stylesheets are 30% smaller. CDN bills, mobile data usage, and energy consumption all benefit slightly. Minification is essentially free — a one-time build step with no maintenance cost.
Paste CSS, get the minified version.
CSS minification is mostly conservative whitespace removal. Whitespace inside selectors, declarations, and values is preserved where significant; whitespace outside is collapsed. Comments are removed unless they begin with /*! (license preservation comments).
Common shortcuts: 0px, 0em, and similar zero-unit values become 0; six-digit hex colors with paired digits (#ffffff, #336699) become three-digit (#fff, #369); the last semicolon before } is removed. Color names are not converted to hex automatically because hex is sometimes longer (red is shorter than #f00 in length; #ff0000 is longer than red).
Output should pass any CSS validator that accepts the input. Browser support is unchanged — minification does not modify the rules themselves, only their text representation.