CSS / JS Minifier

Paste a stylesheet or a script to remove comments and whitespace and make it smaller. You see the size before and after, and syntax errors are pointed out with their line and column.

Language

INPUT

0 characters0 lines

OUTPUT

Runs entirely in your browser. Nothing you enter is sent to a server.

How to minify CSS or JavaScript

  1. Choose CSS or JavaScript

    Pick the language, or open a .css or .js file and it's chosen for you.

  2. Paste the code

    The minified code and the saving appear as you type. Fix any error the message points to.

  3. Copy or download

    Copy the result or download it as a .min.css or .min.js file.

What gets removed

For CSS: comments, extra whitespace, the last semicolon in each block and empty rules. Numbers lose unnecessary zeros (0.50 becomes .5) and colors like #FFFFFF become #fff. Selectors and nesting are kept, and custom property values only lose extra spaces. JavaScript is compressed with the open-source Terser library, which also shortens local variable names if you allow it.

Keep a readable original

Minified code is meant for delivery, not for editing. Keep the original in your project and minify a copy, ideally as part of your build. Comments that start with /*! are copyright notes and are kept unless you turn that off.

Frequently asked questions

Can minifying break my code?

The CSS minifier only removes what can't change how the styles apply. Terser is widely used in build tools, but code that relies on function names or on reading its own source can behave differently when names are shortened. Turn off Shorten variable names if in doubt.

Does it handle modern JavaScript?

Yes. Classes, optional chaining, async functions and modules with import and export are supported. Code with top-level await is minified as a module.

Is my code uploaded?

No. Both minifiers run in your browser. The JavaScript minifier is downloaded the first time you minify JavaScript.