JavaScript Minifier

Safely shrink JavaScript by removing comments and whitespace while keeping line breaks where semicolon insertion depends on them.

Runs in your browser. Your input is processed on your device and is not uploaded to our server.

How to use the JavaScript Minifier

  1. Paste your code or open a file.
  2. Choose the options and click Minify.
  3. Check the result and the size change, then copy or download it.

This is a conservative minifier: it removes comments and unnecessary whitespace but keeps a line break wherever automatic semicolon insertion might change the meaning of the code. It does not rename variables or remove dead code. For production bundles with maximum compression, use a build tool such as esbuild or Terser.

Frequently asked questions

Why are some line breaks kept?
JavaScript inserts semicolons at some line breaks. Removing those line breaks could change what your code does, so the minifier keeps them.
Are licence comments kept?
Yes. Comments starting with /*! are preserved.