JavaScript Minifier and Beautifier

Compress or Format JS Code.

Loading…

Minifying JavaScript removes whitespace and comments, simplifies expressions and renames local variables to single letters. Scripts commonly shrink by half or more.

The work is done by Terser, the minifier behind most build tools, running in your browser. Beautify takes compressed code and lays it out with indentation so you can follow it.

How to use the JavaScript Minifier and Beautifier tool

  1. Paste the JavaScript or open a file.
  2. Choose Minify or Beautify; untick shortening names if other scripts call your functions by name.
  3. Copy the script or download it.
  • Shrinking a script for a website without a build step
  • Reading a minified library to debug it
  • Preparing snippets for bookmarklets and embeds

Tips for the best result

  • Global function names are never renamed, so code that other files call keeps working.
  • A syntax error is reported with its line; fix it and the result appears.

Quick facts

PriceFree
Works withJavaScript
Where it runsIn your browser, on your device
AccountNot needed

Frequently asked questions

Does minified code run the same?

Yes. Terser changes the form of the code, not its behaviour.

Is modern syntax supported?

Yes: modules, classes, async functions, optional chaining and the rest of current JavaScript.

Can beautify restore the original variable names?

No. Shortened names are gone; only the layout is restored.

Is my code sent to a server?

No. The minifier is downloaded once and runs on your device.