Minification workflow

Shrink CSS and JavaScript to speed up your pages

Every kilobyte of CSS and JavaScript delays your page. Minification removes whitespace, comments, and formatting without changing behavior. The CSS minifier and JavaScript minifier work locally, and the page speed guide covers the image side of the same problem.

01

Minify in four steps

Keep the original file; the minified copy goes to production.

2

Paste or open the file

Paste the source or open a local file.

3

Minify

Whitespace and comments are removed in one pass.

4

Copy the output

Replace the production file and verify the page still works.

02

What minification changes

Minification strips whitespace, line breaks, and comments, and shortens some syntax where it is safe. The output behaves identically to the source for standards-compliant code.

For the biggest page-speed wins, combine minified code with compressed images using the image compressor and a server that serves gzip or brotli.

03

Minification mistakes

  • Minifying source files and losing the readable original
  • Breaking code that relied on line breaks in comments
  • Forgetting to test after minification
04

Best practices

  • Keep the readable original in version control
  • Test the minified output in a staging environment
  • Pair minification with compression on the server
05

Frequently asked questions

Does minification change how my code works?

No. It only removes whitespace and comments. Behavior stays identical for standards-compliant CSS and JavaScript.

Can I minify both CSS and JavaScript?

Yes. Separate tools handle each language, with the same local workflow.

How much smaller will my files be?

Most files shrink by 20 to 50 percent depending on how much whitespace and commenting they contain.

Is my code uploaded?

No. Everything runs locally in your browser.

06

Your code stays local

Minification runs in your browser. The source and the output never leave your device.

Open CSS Minifier