JavaScript minifier
Compress JavaScript with Terser to reduce file size. Runs entirely in your browser.
Runs 100% in your browserHow to minify JavaScript
- Paste your JavaScript. Paste the code you want to minify.
- Minify. The compressed output and size saved appear instantly.
- Copy or download. Grab the result with Copy or Download.
About JavaScript minification
Minification shrinks JavaScript so it downloads and parses faster — a direct win for page speed. Terser, the industry-standard minifier, strips comments and whitespace, renames local variables to single characters and removes unreachable code, all while preserving behaviour. Bundlers do this automatically in production; this tool is handy for quick one-off files, snippets or learning what minified output looks like.
Frequently asked questions
- It uses Terser to remove whitespace and comments, shorten local variable names, drop dead code and apply other safe compressions — producing functionally identical but much smaller JavaScript.
- Yes. Terser parses modern ECMAScript (ES2020+), including arrow functions, classes, optional chaining and modules.
- Terser preserves behaviour for valid input. If your code relies on function or variable names at runtime (e.g. some reflection), review the output. Syntax errors in the input are reported.
- No. Terser runs entirely in your browser; your source never leaves your device.