
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.
Why minify CSS in 2026?
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, 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 FastMinify’s online CSS minifier (CSSO, no upload). Production apps still belong in the build. This guide covers CSSO as it actually works, unused-CSS tools that replaced PurifyCSS, Webpack/Vite, and when a paste box is enough.
Minify vs unused CSS vs compression
A “CSS went from 1.8 MB to 420 KB” story is almost never minify-only: that drop is unused-CSS removal on a framework dump, then minify, then gzip. Treat the numbers you see in marketing posts as mixed pipelines. FastMinify’s minifier does not scan your HTML. For the conceptual split with JavaScript tree-shaking, see tree shaking vs minification.

Google’s ranking signal is INP, not FID. Minified CSS can reduce download and parse 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 — do not promise a fixed millisecond or conversion lift. After minify, still enable compression: 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: Compression Level maps to restructure/merge; Aggressive can change source order. The snippets below are the public CSSO API — not invented flags.
Installation
API (Node)
CLI
CSSO’s `usage` option lets you list tags, ids and classes that exist in markup so unused selectors can be dropped. You must maintain that list. It is not a scan of `*.html` / `*.jsx`. Dynamic class names built in JavaScript will disappear if you omit them. Prefer PurgeCSS or Tailwind’s content paths for real unused-CSS removal; keep `usage` for small, known surfaces.

Configuration
Usage
Unused CSS: PurgeCSS, Tailwind, CSSO usage
PurifyCSS is a stale project. In 2026, scan content with PurgeCSS (or Tailwind’s built-in content / `@source` scan). FastMinify does not run this step. After you drop dead rules, minify the remainder with CSSO or cssnano — or paste a chunk into the online CSS minifier to sanity-check a file.
Installation
PurgeCSS (v8 API)
Tailwind: content paths, don’t double-purge
Webpack and Vite production CSS
A production Webpack CSS pipeline usually extracts files with MiniCssExtractPlugin and minifies with css-minimizer-webpack-plugin. That plugin’s default engine is cssnano, not CSSO. You can still run CSSO in npm scripts or a custom minimizer. Vite minifies CSS in production through build.cssMinify — historically esbuild, with Lightning CSS on newer majors. Check the Vite docs for the version you ship; do not copy a “default minifier” from a blog post dated to another major. For WordPress themes without a JS build, see WordPress minification plugins.
Configuration Webpack
package.json
Critical CSS, selectors, online vs build
Inlining above-the-fold CSS and loading the rest asynchronously is not what a minifier does. Extract first, then minify the critical block. Full walkthrough: Critical CSS: extract, minify, inline.
Deep selectors cost parse and specificity fights more than they cost kilobytes. Minify will not flatten `.container .row .card .title` for you. Prefer fewer, stable classes — then minify.
Before
After
Paste-and-minify is the right tool for a child-theme override, a one-off landing CSS file, or checking 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. Trade-offs: online minifiers vs build tools. SCSS/LESS compile first — CSS preprocessor hub — then minify CSS.
Measure CSS, don’t guess
File size on disk is not bytes on the wire. Check the compressed transfer size in DevTools Network, Coverage for unused bytes, and field LCP — not 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 inventing a FastMinify plugin.
Related Articles

Stages, includes, `rules:`: structurally validate a .gitlab-ci.yml before the pipeline runs — not a GitLab runner, not official CI Lint.

Broken YAML, missing `on` or `jobs`, empty steps: structurally validate workflows before you push — and keep actionlint in CI.

SDL syntax errors, schema review and formatting before merge — extends the existing GraphQL beautifier.