Toolstia / JavaScript minifier and beautifier

JavaScript minifier and beautifier

Paste JavaScript to compress it with the Terser minifier or to format it neatly. If the code has a syntax error, you are told where. Your code stays in your browser.

How it works

  1. Paste your JavaScript or press Use sample.
  2. Choose Beautify or Minify.
  3. Copy or download the result.

A real minifier

Minify uses Terser, a widely used tool. It removes comments and whitespace, simplifies code, and can shorten local variable names to save more space.

Shorten variable names

Turning this off keeps the original names, which makes the output easier to debug. Names that other files rely on, such as global functions, are not renamed.

Syntax checking

Terser must understand your code to compress it, so an error message with a line and column points to a typo, such as a missing bracket.

Test before shipping

Run your tests on minified code before you publish it. For big projects a build tool that does this automatically is the better long-term setup.

Questions

Is my code uploaded?

No. Terser runs inside your browser.

Does it support modern JavaScript?

Yes, including arrow functions, classes, async/await and modules.

Why does the page take a moment the first time?

The compressor is loaded only when you first need it, to keep the rest of the site fast.

Does it support TypeScript or JSX?

No. Convert it to plain JavaScript first.