{}
CSS
CSS Minifier FAQ — Minification, Optimization & Performance
Answers about CSS minification, optimization, file size reduction, build tools, and CSS performance best practices.
Q1 What is CSS minification?
CSS minification removes unnecessary characters (whitespace, comments, newlines) without changing functionality, reducing file size by 15-30%. Use the CSS Minifier to compress stylesheets instantly.
Q2 How much does CSS minification save?
Typical savings: 15-30% from whitespace removal. Combined with gzip compression, total savings reach 70-85%. A 100 KB file might minify to 75 KB, then gzip to 15-20 KB.
Q3 Is CSS minification safe?
Yes. Minification only removes characters with no effect on CSS interpretation. It does not change selectors, properties, or values. Source maps preserve debugging ability. Verify with the CSS Minifier.
Q4 What is the difference between minification and compression?
Minification rewrites CSS to remove unnecessary characters (build time). Compression (gzip/Brotli) encodes the file for transfer (per request). Both are essential — minify first, then compress.
Q5 What tools minify CSS?
Online: CSS Minifier. Build tools: cssnano (PostCSS, most popular), clean-css, Lightning CSS (Rust, very fast), esbuild. All major bundlers support CSS minification.
Q6 Should I minify CSS in development?
No. Keep CSS readable during development. Minify only for production builds. Most build tools handle this automatically.
Q7 What is CSS purging?
Purging removes unused CSS rules. Tools: PurgeCSS, Tailwind CSS (built-in). A Tailwind project goes from ~3.5 MB to ~10 KB — 99.7% reduction.
Q8 What is critical CSS?
Critical CSS is the minimum CSS for above-the-fold content, inlined in the head. The rest loads asynchronously. Can improve LCP by 1-3 seconds.
Q9 How do I minify CSS in Webpack?
Use
css-minimizer-webpack-plugin. In production mode, Webpack enables it automatically.
Q10 What is PostCSS?
PostCSS is a CSS transformation tool using JavaScript plugins: autoprefixer, cssnano, postcss-preset-env, tailwindcss. It processes CSS after writing.
Q11 What is CSS-in-JS?
CSS-in-JS writes CSS in JavaScript: styled-components, Emotion. Advantages: scoped styles, dynamic styling. Disadvantages: runtime overhead. Alternatives: CSS Modules, Tailwind.
Q12 How do I reduce CSS file size?
Steps: (1) remove unused CSS; (2) minify with CSS Minifier; (3) use shorthand properties; (4) combine duplicate selectors; (5) use CSS variables; (6) enable compression.
Q13 What is Brotli compression?
Brotli achieves 15-25% better compression than gzip. Most modern browsers support it. Combined with minification, a 100 KB CSS file can become ~10 KB.
Q14 How do I unminify CSS?
Also called beautifying. VS Code: Format Document. CLI:
npx prettier --parser css file.min.css. Comments lost during minification cannot be recovered.
Q15 What is a CSS source map?
Source maps link minified CSS back to original source, enabling browser DevTools to show original files and line numbers. Only loaded when DevTools is open.
Q16 What is the difference between Sass, Less, and CSS?
Sass and Less are preprocessors adding variables, nesting, mixins. Modern CSS now has variables and nesting. Many teams are migrating to vanilla CSS + PostCSS.
Q17 How do I optimize CSS for Core Web Vitals?
LCP: inline critical CSS, preload fonts. CLS: set explicit dimensions. INP: minimize CSS that triggers long style recalculations.
Q18 Should I use CSS @import?
Avoid in production. Each @import creates a sequential HTTP request. Use build tools to concatenate files. Sass @import resolves at build time and is fine.
Q19 What is CSS Modules?
CSS Modules scope class names to components by generating unique identifiers. Supported by Webpack, Vite, Next.js. No runtime overhead.
Q20 How do I check CSS file size?
Browser DevTools Network tab, filter by CSS. CLI:
wc -c style.css. Target: under 50 KB total CSS (compressed) for most sites.
Free CSS Tools
All tools run in your browser — no signup, no data sent to servers.