
CSS Minification Guide: CSSO, Unused CSS, Builds
How to minify CSS in 2026: CSSO (and friends), unused-CSS removal, Vite/Webpack, vs an online minifier. Honest limits before you chase bytes.
What CSS minification does and does not do
Minifying CSS is not the same job as deleting unused rules, extracting critical CSS or enabling gzip/Brotli. Minification rewrites the stylesheet you already ship into a shorter form. Comments and whitespace go away, colors and zeros get shorter, and adjacent duplicate selectors can merge. Class names stay the contract with your HTML, unlike JavaScript mangling. You can try that step in the browser with the FastMinify online CSS minifier (CSSO, no upload). Production apps still belong in the build. This guide covers CSSO as it actually works, the unused-CSS tools that replaced PurifyCSS, Webpack and Vite, and when a paste box is enough.
Minify, remove unused CSS, compress
A “CSS went from 1.8 MB to 420 KB” story is almost never minification alone. Such a drop usually combines unused-CSS removal on a framework dump, then minification, then gzip, so treat figures from marketing posts as mixed pipelines. FastMinify’s minifier does not scan your HTML. For the same split in JavaScript, see tree shaking vs minification.

INP replaced FID as a Core Web Vital in March 2024. Minified CSS can reduce the download and parsing of render-blocking stylesheets, which may support LCP. It does not rename classes, extract above-the-fold rules or fix layout shift from unsized images. Measure with Lighthouse or CrUX, and do not promise a fixed number of milliseconds or a conversion lift. After minifying, still enable compression: see the Apache and Nginx GZIP/Brotli guide.
Setting up CSSO (the minifier FastMinify uses)
CSSO (CSS Optimizer) parses with CSSTree, then cleans, compresses and optionally restructures rulesets. FastMinify’s Minify CSS page runs CSSO in your browser. Its Compression Level setting decides how far that goes. Conservative keeps every rule and re-indents the output. Normal minifies and keeps the cascade order. Aggressive restructures rulesets, which can change source order. The snippets below use the public CSSO API.
Installation
API (Node)
CLI
CSSO’s `usage` option lets you list the tags, ids and classes that exist in your markup, which lets CSSO drop unused selectors. You must maintain that list. It does not scan `*.html` or `*.jsx` files, and class names built in JavaScript will disappear if you leave them out. For real unused-CSS removal, use PurgeCSS or Tailwind’s content paths, and keep `usage` for small, known surfaces.

Configuration
Usage
Removing unused CSS with PurgeCSS and Tailwind
PurifyCSS has not been maintained for years. In 2026, scan your content with PurgeCSS or with Tailwind’s built-in content and `@source` scan. FastMinify does not run this step. After you drop dead rules, minify the remainder with CSSO or cssnano, or paste a file into the online CSS minifier to check the result.
Installation
PurgeCSS (v8 API)
Tailwind content paths without a second purge
Webpack and Vite production CSS
A production Webpack CSS pipeline usually extracts files with MiniCssExtractPlugin and minifies them with css-minimizer-webpack-plugin. That plugin’s default engine is cssnano, not CSSO, although you can still run CSSO in npm scripts or a custom minimizer. Vite minifies CSS in production through build.cssMinify: Lightning CSS by default in recent versions, esbuild in earlier ones. Check the Vite documentation for the version you ship rather than copying a “default minifier” from a post written for another major version. For WordPress themes without a JS build, see WordPress minification plugins.
Configuration Webpack
package.json
Critical CSS, selectors, online or build
A minifier does not inline above-the-fold CSS or load the rest asynchronously. Extract the critical rules first, then minify that block. The full walkthrough is in Critical CSS: extract, minify, inline.
Deep selectors cost parsing time and specificity fights more than they cost kilobytes. Minification will not flatten `.container .row .card .title` for you, so prefer fewer, stable classes and minify after.
Before
After
Paste-and-minify suits a child-theme override or a one-off landing page stylesheet. It also shows what CSSO does to a snippet before you change the build. It is the wrong tool as the only production pipeline for an app that ships on every commit. The trade-offs are covered in online minifiers vs build tools. If you write SCSS or Less, compile first with the CSS preprocessor hub, then minify the CSS.
Measure CSS, don’t guess
File size on disk is not bytes on the wire. Check the compressed transfer size in DevTools Network, unused bytes in Coverage, and field LCP. Do not rely on a single invented “CSS performance score”.

A Lighthouse score of “the whole page” is not a CSS budget. Prefer a max size on the extracted CSS artifact, then optionally a performance assertion on a stable URL.
Configuration GitHub Actions
Try our free minification tools to optimize your code:
JavaScript Minifier
Minify, unminify and beautify your JavaScript code instantly.
CSS Minifier
Optimize your CSS stylesheets for better performance.
JSON Formatter
Format minified JSON with customizable indentation — dedicated JSON tools cluster.
SVG Optimizer (SVGO)
Deep SVGO optimization beyond quick minify — safe, default and aggressive presets.
Prepare strings for URLs, markup, or API payloads — everything stays in the browser:
Base64
Encode or decode UTF-8 text as Base64, including URL-safe alphabet.
URL encode
Percent-encode query components or full URIs with encodeURIComponent, encodeURI, or form scopes.
URL decode
Decode percent-encoded query strings and URLs — component, full URI, or form-urlencoded.
HTML entities
Escape or unescape &, <, quotes, and named entities before inserting into markup.
What to do next
Minify CSS with CSSO or cssnano in the build you already trust. Remove unused rules with PurgeCSS or Tailwind’s content scan, not with PurifyCSS and not with FastMinify’s paste box. Use the online CSS minifier to inspect a file or a custom snippet. If the site is WordPress without a frontend build, start with plugin minification on staging rather than looking for a FastMinify plugin.
Related Articles

Paste a token and a JWKS to check an RS256, ES256 or HS256 signature in your browser. How kid picks the key, measured errors and the claims to check.

HTTP/2 and HTTP/3 change how files travel, not how big they are. Measured sizes, compile times and bundling tests show what minification still saves.

Convert a Unix epoch to a readable date and back, tell seconds from milliseconds, and avoid time zone, JWT and clock change traps, all in your browser.