JavaScript Minifier
Shorten a script without sending it to a server.
About this tool
The minifier runs in this page after you start it. The script is not executed.
Syntax the parser rejects is reported. This is not a bundler.
How to use it
- Open this page and provide the input it asks for.
- Set the options that are visible, then use Minify JavaScript.
- Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.
Limitations
- Syntax the parser rejects is reported. This is not a bundler.
Terser compresses names as well as spaces
Compression is not a whitespace trim
Terser compresses and mangles. The page asks that library for a minify with compression enabled and name mangling enabled. Locals can be renamed. Code the compressor decides is unused can disappear. Constant expressions can be folded into simpler forms. The original indentation is not preserved and cannot be recovered from the result by reversing a spacing rule, because the changes are not only spacing. If the library returns no code, the page says the minifier did not return code.
The program is not launched as a page script. Nothing in the paste is invoked for its side effects as your program. The compressor still changes the text in ways a formatter will not. The formatter uses js-beautify and keeps names. This page does not keep names. A later beautify of the minified result will indent the short names. It will not restore the names you typed.
Bindings that strings look up can break
Mangling renames bindings. Code that reaches a local through a string built at runtime can miss after the rename, because the string still has the old spelling. Function names that your own logs or error text expected can change. That is a reason to minify a build artifact you control, and a reason not to minify a snippet whose behavior depends on exact identifier spellings. The page has no switch to compress without mangling. Both are on.
The validator is still a different question
A successful minify does not mean a type checker approved the script. It means the compressor returned text. Syntax the compressor cannot read fails. The Acorn validator answers whether the paste parses as a module, and it does not shorten anything. Use this page when you want a shorter script and you accept renamed locals. Use the formatter when you want the same names with cleaner indent.
Privacy
Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.

