handy.moe

All tools / Debug tools

A pencil

JavaScript formatter, beautifier and minifier

Minify JavaScript with Terser, or beautify minified code so you can read it. Your source stays on your device.

Runs in your browser. Pasted data never leaves it.

How to use it

  1. Paste your JS or drop a file on the box.
  2. Choose Beautify to make it readable or Minify to make it small, and adjust the options.
  3. Press Run (it also runs as you type).
  4. Copy or download the result.

Questions

What does Terser do?

Terser is the standard JavaScript minifier. It removes whitespace and comments, shortens local variable names (mangling), drops unreachable code and simplifies expressions. The code behaves the same; use source maps in your own build for debugging.

Does minifying change what the code does?

No. Only whitespace, comments and names that can't be seen from outside are changed. Code that relies on function names (fn.name) or on eval can behave differently: test the result.

Is my code uploaded?

No. Formatting and minifying run in your browser, and your code never leaves your device.

How much smaller does it get?

The size of the result is shown under the output. Typical savings are 20–40% for CSS, 15–30% for HTML and 40–70% for JavaScript before gzip, and less after.

Is what I paste or test sent anywhere?

No. This page works entirely inside your browser, and pasted data never leaves your device. It makes no network requests while you use it, and the page also tells your browser to block them (a Content-Security-Policy with connect-src 'none'), so even a bug could not send your data out. To check it yourself, open your browser's developer tools, go to the Network tab, and use the tool: nothing will appear. There is no account, no analytics and no logging.