JavaScript Minifier
Reduce JavaScript file size with optional compression and identifier mangling. See the before-and-after byte count, then copy or download the minified source.
Choose how much to compress
Compression simplifies code; mangling shortens local identifiers. You can switch either off independently.
CompressApply safe syntax simplifications and remove code the compressor determines is unused or unreachable.Mangle local namesShorten local variables and parameters. In script mode, top-level names are not mangled by default; module mode enables top-level optimization.License commentsBy default, retain comments recognized as license or preservation notices and remove ordinary comments.Script / ES moduleChoose ES module mode for source containing import or export. Module mode implies strict semantics and top-level optimizations.Your source stays in the browser
Minification runs in a dedicated Web Worker using a self-hosted Terser 5.51.2 bundle. The source is parsed and transformed as text; it is never evaluated, rendered, uploaded or saved by this tool.
Input is limited to 1 MiB. Project configuration, source maps and remote plugins are not loaded. Compression may transform behavior when code relies on dynamic scope or non-standard patterns, so inspect and test the output in your project.
Terser is distributed under the BSD 2-Clause License. A copy of the license is included in the self-hosted vendor directory.
Frequently Asked Questions
No. Terser parses and transforms the source in a local worker; the source is never evaluated.
Use Script for ordinary scripts. Choose ES module when the source contains import or export. Module mode enables strict mode and top-level optimization, so review the output carefully.
By default, Terser keeps comments it recognizes as license or preservation comments. Choose Remove all or Keep all to change this behavior.
Not on this page. The tool returns minified JavaScript only and does not load project configuration or source-map files.
No. Minification happens locally in your browser and the tool does not save or upload your source.