한국어
Home › Developer › JS & CSS Minifier

JS & CSS Minifier

Remove whitespace and comments and shorten JavaScript, CSS and HTML to cut file size. See how much you saved, then copy the result or save it as a file.

Source code
Minified result

Settings

Your code never leaves this device

How to use

1Add codePaste your code or drop a .js, .css or .html file.
2MinifyThe language is detected automatically. For JavaScript you can choose options.
3Copy or saveCopy the result or save it as a file such as .min.js.

When it helps

JavaScript and CSS written for people are full of spaces, line breaks and comments. Browsers do not need any of that, so stripping it makes files smaller and pages load a little faster. It is especially useful for small sites without a build step, blog widgets and bookmarklets.

JavaScript is processed with terser, a widely used minifier, so it shrinks far more than just removing spaces. Local variable names get shorter and dead code is dropped. For CSS and HTML only comments and unneeded whitespace are removed safely, and the contents of strings, pre, textarea and script are left untouched.

Minifying is not a way to hide code. Minified code can be pretty-printed again, so never put passwords or API keys in client-side code in the first place.

FAQ

Can minifying break my code?

terser only makes changes that keep the behavior the same. If your code relies on eval or function names (fn.name), turn off Shorten variable names and try again.

It says there is a syntax error.

Code with a JavaScript syntax error cannot be minified. The error message shows the line and column, so fix that spot and try again.

Does it shorten names in CSS or HTML too?

No. For CSS and HTML only comments, line breaks and unnecessary spaces are removed. Class names and similar are not changed.

Can I stop others from reading my code?

Minifying reduces size and gives almost no protection. Anything important should be handled on the server.

Is my code sent to a server?

No. The minifier is downloaded to your browser and runs on this device.