Free CSS Minifier & Beautifier
Minify CSS to reduce file size or beautify minified CSS for readability. Instant, in your browser.
Drop a .css file here, or click to browse
CSS Β· processed on your device
or press Ctrl+V to paste from your clipboard
Common uses
- Minify CSS for Production DeploymentReduce CSS file size before deploying to production β faster page loads and lower bandwidth costs.
- Beautify Minified CSS for DebuggingFormat compressed or minified CSS into readable code so you can inspect and debug styles.
- Minify CSS for Email TemplatesCompact CSS for HTML email templates where file size and inline style bloat matter.
- Minify CSS for WordPress ThemesReduce the size of custom WordPress theme stylesheets for better PageSpeed scores.
- Beautify CSS for Code ReviewFormat any CSS file into clean, indented, readable code ready for review and collaboration.
How It Works
This tool uses a hand-written, zero-dependency CSS tokenizer built entirely in JavaScript β no external libraries, no server calls. The tokenizer classifies every character as code, comment, quoted string, or url() value before applying any transformations, which prevents whitespace rules from corrupting string contents, data URIs, or calc() expressions.
- 1Tokenization passThe input CSS is scanned character-by-character and split into typed tokens: raw code segments, /* ... */ comments, quoted strings (preserving escape sequences), and url(...) blocks. This ensures that transformations in the next step only touch actual CSS syntax β never the contents of a string literal or data URI.
- 2Minification or beautificationIn minify mode, regular comments are dropped (/*! license */ comments are kept), runs of whitespace in code tokens are collapsed to single spaces, and punctuation-adjacent whitespace around { } : ; , > ~ is removed. Spaces around + and - are intentionally left alone to avoid breaking calc() expressions. In beautify mode, the code is first minified to a clean baseline, then re-tokenized and re-indented with two-space depth tracking and declaration-colon detection to distinguish property: value colons from selector colons like a:hover.
- 3Gzip size estimateAfter producing the output, the browser's native CompressionStream API is used to compress the result with gzip and measure the resulting byte count. This gives a realistic transfer-size estimate matching what a web server with gzip compression would send over the network.
- 4Copy or downloadThe processed CSS is written to the clipboard via the Clipboard API, or downloaded as styles.min.css (minify mode) or styles.css (beautify mode) using a Blob with MIME type text/css. The size reduction percentage is shown live as you type.
Related Tools
SVG Optimizer & Minifier
Strip metadata, collapse whitespace, and round decimals to dramatically shrink SVG file size β typical reductions of 30-70%. Visual preview verifies nothing breaks.
CSS Beautifier
Pretty-print minified CSS with consistent indentation, or minify it. Optional alphabetical property sorting for predictable diffs.
JSON Formatter
Format, validate, minify, and explore JSON data. Tree view, syntax highlighting, and one-click copy.