What is a JavaScript Minifier?
A JavaScript minifier shrinks your code by removing whitespace, comments and extra characters, and by renaming local variables to short names. The result behaves the same but downloads faster. This tool uses Terser, the same engine behind most modern build tools, and runs fully in your browser.
When to use it
Use it when you need a quick production-sized copy of a script without setting up a bundler: a snippet for a landing page, a bookmarklet, an inline script in an email template, or a one-off file you want to check the size of. It is also handy for seeing how much a build step would actually save.
How it works
Paste your JavaScript and the tool runs Terser with compression and name mangling turned on. Terser parses the code into a syntax tree, simplifies it (dead code removal, shorter expressions) and prints it back with no extra spacing. If your code has a syntax error, you get the error message instead of broken output. Nothing leaves your browser.
Frequently asked questions
Is it safe to paste my code here?
Yes. The minifier runs in your browser, so your code is not sent to any server.
Will minifying change how my code works?
It should not. Terser keeps behavior the same. Problems usually come from code that relies on function names or uses eval, so test the minified file before shipping it.
How much smaller will my file get?
It depends on how many comments and long names the file has. Heavily commented code often shrinks by half or more. Serving the file with gzip or Brotli on top gives further savings.
What is the difference between minifying and obfuscating?
Minifying aims for a smaller file. Obfuscating aims to make code hard to read. Minified code is hard to read as a side effect, but it can be reversed with a beautifier. It is not a security measure.