Skip to main content

Free CSS Minifier & Beautifier

Minify CSS to reduce file size or beautify minified CSS for readability. Instant, in your browser.

Works offline once loaded
or drop a .css file below

Drop a .css file here, or click to browse

CSS Β· processed on your device

or press Ctrl+V to paste from your clipboard

Browse files
Input CSS
Output CSS
Output will appear here…

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.

  1. 1
    Tokenization pass
    The 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.
  2. 2
    Minification or beautification
    In 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.
  3. 3
    Gzip size estimate
    After 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.
  4. 4
    Copy or download
    The 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

Frequently Asked Questions