User Rating 0.0
Total Usage 0 times
Category CSS Tools
Is this tool helpful?

Your feedback helps us improve.

About

Unminified CSS carries dead weight: block comments, trailing semicolons, redundant whitespace, and line breaks that browsers discard during parsing. A typical stylesheet loses 15 - 40% of its transfer size to these characters. On HTTP/1.1 connections without Brotli or gzip, every excess byte directly increases Time to First Paint. This tool strips all non-functional characters from valid CSS while preserving semantic correctness. It handles nested @media blocks, url() references with quoted or unquoted paths, and content strings containing whitespace-sensitive values. The output is a single-line, deployment-ready stylesheet. Note: this is a syntactic minifier. It does not merge duplicate selectors or perform shorthand collapsing. For critical-path CSS, always validate the minified output against your rendering target.

css minifier minify css css compressor css optimizer reduce css size web performance

Formulas

The compression ratio quantifies how much dead weight was removed from the original stylesheet:

R = Soriginal SminifiedSoriginal × 100

Where R = compression ratio in %, Soriginal = byte size of input CSS (UTF-8 encoded via TextEncoder), and Sminified = byte size of output CSS after all transformations. Byte size is used instead of character count because multi-byte characters (emoji in content: properties) would skew length-based calculations. A ratio of 0% means the input was already fully minified. Ratios above 50% typically indicate heavily commented source files.

Reference Data

OptimizationCharacters AffectedTypical SavingsRisk Level
Strip block comments /* … */All comment content5 - 20%None
Remove line breaks & tabs\n, \r, \t3 - 10%None
Collapse consecutive spacesMultiple \x20 → single2 - 8%None
Trim around { }Spaces before/after braces1 - 3%None
Trim around :Space after property colon1 - 2%None
Trim around ;Spaces before semicolons0.5 - 1%None
Remove trailing ; before }Last semicolon in block0.5 - 2%None (CSS spec allows)
Trim around , in selectorsSpaces around commas0.5 - 1%None
Trim around > ~ +Combinator spacing0.2 - 0.5%None
Preserve url() contentQuoted/unquoted paths0% (no change)Must preserve
Preserve string literalscontent: "..."0% (no change)Must preserve
Strip @charset duplicatesRedundant charset rules0.1 - 0.3%Low
Normalize zero values0px00.1 - 0.5%Low
Shorten hex colors#ffffff#fff0.1 - 0.3%None
Combined total (typical)All non-functional chars15 - 40%None if parser-safe

Frequently Asked Questions

No. The minifier only removes characters that CSS parsers treat as insignificant: comments, excess whitespace, trailing semicolons before closing braces, and redundant spacing around operators. The computed styles applied by the browser remain identical. The CSS specification (W3C Syntax Module Level 3) explicitly permits omitting the last semicolon in a declaration block.
The parser tokenizes quoted strings (single and double) and url() arguments before any whitespace collapsing occurs. These tokens are replaced with placeholders, the minification runs on the remaining text, and then the original tokens are restored. This prevents paths like url('my file.png') from having internal spaces stripped.
Files under 500 KB process in under 100 ms on modern hardware. For files between 500 KB and 5 MB, the tool offloads minification to a Web Worker to prevent UI freezing. Files above 5 MB are accepted but may take 1-3 seconds depending on comment density. The practical limit is constrained by browser tab memory, typically around 50-100 MB of text.
Yes. The minifier operates at the character level without interpreting CSS semantics. It does not parse selectors or at-rules for meaning - only for structural characters like braces, colons, and semicolons. This means @layer, @container, @supports, nesting syntax, and custom properties like --my-var all pass through safely.
Minification and gzip compression are complementary but independent. Minification removes literal characters, reducing raw file size. Gzip uses LZ77 and Huffman coding to compress repetitive byte sequences. A minified file typically gzips 10-15% smaller than an unminified file would gzip, because there are fewer unique whitespace patterns to encode. Always apply both: minify first, then serve with gzip or Brotli.
Not from this tool. Minification is a lossy transformation with respect to formatting - comments, indentation style, and whitespace preferences are permanently removed. Always keep your original source files in version control. If you need to read minified CSS, use a separate CSS beautifier/formatter tool to reconstruct indentation (though comments will remain lost).