Skip to content
Motifuse
Free browser tool
Developer

CSS Minifier

Remove CSS comments and unnecessary whitespace, show size savings, and copy or download the minified stylesheet.

  • Free public tool
  • No sign-up for this tool
  • Processing clearly labeled
  • Instant results

Content last reviewed

43 characters · 4 lines

Overview

A transparent whitespace minifier for simple CSS—not a parser-backed optimizer

Remove block comments, collapse whitespace, tighten common punctuation, and drop a trailing semicolon before a closing brace. The page now measures real UTF-8 byte counts, while its limitations explain why complex strings, data URIs, hacks, and recovery from invalid CSS require a proper parser and rendering test.

Five visible text rules

Comments, whitespace runs, punctuation spacing, trailing semicolons, and edge whitespace are transformed.

Actual byte saving

Original and minified values use Blob byte lengths, with a percentage derived from those bytes.

Regex limits stated

The tool does not claim to understand the CSS grammar or prove an identical rendering.

minified.css export

Copy or download the live output while keeping the readable source as the canonical file.

How it works

Using CSS Minifier, start to finish

Three steps, in the order the tool above actually takes them.

  1. 1

    Paste a simple stylesheet

    Use source without preprocessors and avoid relying on unusual comment-like sequences in strings or URLs.

  2. 2

    Review output and byte delta

    Inspect the transformations rather than treating the percentage as a correctness signal.

  3. 3

    Render-test before deployment

    Compare representative pages and use the project's parser-backed build minifier for production CSS.

Use cases

What people bring here

The jobs this page is usually opened for, and the setting that makes each one quick.

A small standalone snippet

Compact straightforward declarations for a constrained embed or handoff.

Keep the original comments and formatting in source control; the output is a derivative.

Teaching minification basics

Show how comments and whitespace affect source bytes without changing selector intent.

Use simple CSS in the demonstration so regex limitations do not obscure the lesson.

A quick size comparison

Estimate how much uncompressed source weight is common whitespace and commentary.

Measure compressed transfer size in the deployment pipeline; gzip or Brotli changes the practical saving.

CSS has grammar and context

Text replacement cannot distinguish every token from token-like content

A parser knows whether characters appear in a comment, string, URL, custom property, or declaration. These compact rules do not carry that context, which is why the page is scoped to simple input and mandatory testing.

Comment-like string

Every /* ... */ sequence is definitely a comment.

A parser can distinguish token context; this page's first rule cannot.

Whitespace

Every space is removable without affecting token boundaries.

Some grammar positions require separation; parser-backed minifiers preserve it contextually.

Invalid CSS

Minification preserves the browser's recovery behavior.

Fix and validate the source before optimizing; recovery can change after text is rewritten.

Unused rules

A smaller result means dead selectors were removed.

No usage analysis, cascade analysis, or selector merging runs here.

Privacy

Where your work is processed

The stylesheet is transformed locally and is not uploaded or autosaved. The split divider alone may persist for the current tab session.

Source content stays in the tab

Encoding, parsing, formatting, generation, comparison, and cryptographic operations run in browser code. Form values and uploaded text files are not sent to a processing API.

Inputs are not autosaved

Code, tokens, secrets, URLs, and generated outputs stay in component memory until the page reloads or closes. Split-pane tools remember only the divider percentage for the current tab session.

Clipboard and downloads are explicit

The page reads the clipboard only after a Paste action and writes it only after Copy. A local download is created only when you choose the tool's download control.

One aggregate page view may be counted

The page shell can send the tool slug, never the editor contents or filename. The endpoint is rate-limited using a transient requesting address and is skipped for Do Not Track or Global Privacy Control.

More detail in how processing works and our privacy policy.

Limits

The exact minification pass

The values this tool actually enforces, not a rounded-up version.

Engine
Regex text rules
No CSS parser or AST is created.
Measurement
UTF-8 bytes
Blob sizes drive Original, Minified, and Saved.
Optimization
Whitespace + comments
No colour, unit, selector, or property rewriting.
Export
minified.css
Output is produced locally from the live string.

Complex CSS needs a parser-backed build tool and browser regression test

This is a regex-based whitespace minifier, not a CSS parser. It does not merge duplicate selectors, shorten colours or units, remove unused rules, add vendor prefixes, or understand @media and @supports structure. Unusual constructs — comment-like text inside a data URI, for instance — can confuse it, so check the output on anything complex.

FAQ

CSS minification questions

The ones that actually come up.

Guides

Reading that goes deeper

Find this useful? Share it.