What CSS Minification Does
A CSS minifier parses a stylesheet, removes comments and optional whitespace, shortens compatible values, and prints fewer bytes. Safe mode disables cross-rule restructuring. Optimized mode can also merge or reorganize compatible rules. Neither mode removes selectors based on the HTML that uses them.
Formatting vs Minification
Formatting is for reading, reviewing, and editing. It adds consistent indentation and line breaks but does not reconstruct an author's exact source. Minification is for delivery. Keep a readable source file in version control and treat minified CSS as a generated artifact.
Why Smaller CSS Helps
Fewer bytes can reduce transfer and parse work, especially across many visits or on slower connections. Web servers and CDNs should also apply gzip or Brotli. Transport compression and minification complement each other: one encodes repeated bytes, while the other removes or simplifies source characters.
Cascade and Compatibility Checks
CSS behavior depends on selector specificity, source order, layers, inheritance, custom properties, and browser support. Optimizers are designed to preserve behavior, but legacy hacks, unusual vendor syntax, and deliberately repeated fallbacks deserve visual regression testing.
When a Build Pipeline Is Better
Use PostCSS, Lightning CSS, CSSO, clean-css, or a bundler integration when you need repeatable builds, source maps, prefixing, nesting transforms, imported files, asset rewriting, or automated tests. A browser tool is most useful for snippets, one-off files, and inspecting compact CSS.
Validation Limits
Parsing confirms that the processing engine can understand the stylesheet; it is not a complete standards or browser-compatibility audit. Unknown property names and many unknown values are valid CSS grammar, while support differs by browser. Use browser developer tools and compatibility data for deployment decisions.