Web Performance

Code Minifier

Paste your raw CSS or JavaScript below to strip whitespace, comments, and line breaks.

Savings will be calculated here.

Web Performance Guide

Learn how code minification improves your website.

Why Minify?

Minification removes unnecessary characters from your code without changing its functionality. This reduces file sizes and speeds up page load times.

What Gets Removed?

The process safely strips out developer comments, extra spaces, line breaks, and block indentations that browsers do not need to read.

What minification does and what it costs

Minification removes everything a browser does not need in order to execute your code: comments, indentation, line breaks and redundant whitespace. The behaviour is identical; the file is simply smaller and therefore faster to transfer.

How much it actually saves

Typical savings run from 20 to 40 percent on CSS and JavaScript, with heavily commented source at the upper end. On a file of a few kilobytes that is a marginal gain, but across a bundle of several hundred kilobytes it is a real improvement to load time.

Compression matters more than minification on its own. Gzip or Brotli applied at the server level typically cuts another 70 to 80 percent, and the two stack. Minifying without enabling server compression leaves the larger win on the table.

Working with minified code

Always keep your readable source as the file you edit. Minified output is a build artefact, not something to maintain by hand, and a one-line file is effectively impossible to debug.

Generate source maps as part of your build if you can. They let browser developer tools show you the original source while running the minified version, which turns an unreadable stack trace back into a useful one.

Minification is not obfuscation. Names get shorter and structure gets compressed, but anyone can run the file through a formatter and read it. Never treat it as a way to hide keys or logic.

Enable compression too

Gzip or Brotli at the server level saves far more than minification alone. Both together is the right answer.

Keep the source

Edit the readable file and minify as a build step. Never hand-edit the minified output.

Not a security measure

Minified code is trivially reformatted. It hides nothing from anyone who looks.

Frequently asked questions

Does minifying break my code?

Correct minification preserves behaviour exactly. Problems almost always trace to missing semicolons in the source, which can change meaning once line breaks are removed.

Should I minify if I already use gzip?

Yes. They compress different redundancies and the savings stack, though gzip contributes the larger share.

How do I debug minified code?

Generate source maps during the build. Browser developer tools then display your original source while executing the minified file.

Is minified code protected from copying?

No. Any formatter restores readable structure in seconds. Minification is a performance technique, not a security one.