Home › CSS and JavaScript Minifier

CSS and JavaScript Minifier

Paste a stylesheet or a script to strip comments and whitespace and see how many bytes you save before serving it.

Results

Size before
113 B
Size after
75 B
Saved
33.6 %

How it works

The CSS minifier removes comments, collapses whitespace, drops spaces around braces, semicolons, commas and combinators, and removes the last semicolon of each block, while leaving strings untouched. The JavaScript minifier tokenizes the code so strings, template literals and regular expressions are preserved, removes comments and indentation, and keeps line breaks that automatic semicolon insertion may depend on. It does not rename variables.

Rules and details

Worked example

The sample stylesheet weighs 113 bytes and becomes 75 bytes after minification, a saving of 34 %. The result is: .card{margin:0 auto;padding:16px 24px;color:#333333}.card>p{font-size:14px}

Frequently asked questions

Is this as strong as a build tool such as Terser?

No. Full minifiers rename variables and rewrite expressions to save more. This tool focuses on safe whitespace and comment removal, which is enough for small snippets and quick checks.

Will minified JavaScript behave the same?

The tool is designed to keep behavior identical, and it preserves line breaks to protect code that relies on automatic semicolon insertion. For production code, run your tests on the output.

Why is the saving smaller than I expected?

Savings depend on how much indentation and commenting the source had. Compressing with gzip or Brotli on your server adds a much larger reduction on top.

Tips

Related tools

All tools