JavaScript Minifier
Parse JavaScript source to remove unnecessary spacing and simplify code. Terser runs in a separate Web Worker that can be cancelled and stops after 10 seconds. Defaults are ordinary script mode, compression enabled and variable mangling disabled. Input code is not executed.
Key features
- Select ordinary script or ES module mode
- Control compression and variable mangling separately
- Configure function and class names and license-style comments to be retained
- Cancel the Worker or let the 10-second limit stop long tasks
How to use
- Paste JavaScript and choose ordinary script or ES module mode.
- Choose variable mangling and compression settings. Review externally referenced names before enabling mangling.
- Run the task; cancel or reduce input if processing takes too long.
- Copy the result and test it in the intended runtime before using it.
Use cases
- Reduce the size of a small standalone JavaScript file
- Compare script and module compression results
- Evaluate output with and without local variable mangling
Frequently asked questions
Is input code executed or uploaded?
Input is parsed and printed as JavaScript syntax in a browser Worker. It is not executed with eval or function calls and is not sent to a server for this tool’s processing.
Should I choose script or module mode?
Select module for ES modules containing import or export. Module mode assumes strict mode and module scope; do not apply it blindly to an ordinary script that depends on global side effects.
Does variable mangling rename everything?
When enabled, Terser can shorten permitted local variable names. Property mangling and aggressive eval handling are disabled; function and class names are configured to be retained. Test code that uses external references or dynamic access.
Are comments and source maps preserved?
Terser’s license-style comments, such as @license, @preserve and /*!, are configured to be retained. Other comments may be removed, and no source map is generated. Check required legal notices against the original source.
Does this handle TypeScript, JSX or legacy browser transpilation?
This is a JavaScript minifier. TypeScript and JSX are not supported. It does not transpile syntax for older browsers or provide obfuscation that protects secrets.
What happens when I cancel or hit the timeout?
The Worker is terminated and no partial output is shown. Input is limited to 100,000 UTF-16 code units and execution to 10 seconds. Reduce input or disable compression before retrying.
Privacy
Input and results are processed in browser memory; this tool does not upload or store them. Reloading clears them. Site-wide advertising and analytics may operate separately, but tool usage events do not contain your input or output.
Comments & questions