JavaScript & CSS Minifier

Pick a language, paste your code and press “Minify”.

Your text and files never leave your browser — nothing is sent to a server.

How to use

  1. Choose JavaScript or CSS under “Language” and paste your code.
  2. Press “Minify” to remove whitespace, line breaks and comments. The size before and after, and the percentage saved, appear below the result.
  3. With “Shorten variable names” on, local variables inside functions are renamed to one or two letters for an even smaller file. Global names used elsewhere are left alone.
  4. Comments that start with /*! or contain @license are kept while “Keep license comments” is on.

FAQ

Can minifying change how my code behaves?

JavaScript is minified with Terser and CSS with CSSO, widely used open-source tools designed to keep behavior the same. Code that relies on eval or on function names may still behave differently, so test before you deploy.

Does it work with ES modules?

Yes. If the code contains import or export statements, it is minified as an ES module. Otherwise it is treated as a classic script and global names are not renamed.

Can I turn minified code back into readable code?

Line breaks and indentation can be restored with the JavaScript & CSS Formatter, but removed comments and shortened names cannot be recovered, so keep your original source.

Related tools

All tools