JavaScript Minifier
NEWMinify JavaScript with Terser: compress and mangle code, see the size saved, and copy or download the result.
Runs 100% in your browser — your input is never uploaded or stored on our servers.
Minification is only as safe as the code. Code that uses eval, new Function, fn.name or reads property or variable names from strings can break, and with Top-level scope on, global names used by other scripts or inline onclick handlers are renamed. Always test the minified file.
Quick Examples
Typical inputs and the results this tool produces.
Overview
This JavaScript minifier shrinks scripts with Terser, the same engine used by many build tools. It removes whitespace and comments, shortens local variable and function names, and simplifies expressions so the file downloads and parses faster.
Developers use it to compress a snippet, a bookmarklet or a legacy script without setting up a bundler. Choose compress passes, mangle and top-level options, an ECMAScript target (ES2015 to ES2022), ES module mode, which comments to keep and which names to preserve, and optionally generate a source map.
Everything runs in your browser. Your code is never uploaded, and you see the original size, minified size, percentage saved and a gzip estimate right away.
Why use this tool?
- Smaller scripts with real Terser compression
- Keep license comments, drop console calls
- Source map output for easy debugging
- Shows exact size and gzip savings
- Private: code never leaves your browser
Features
Compress and mangle
Inline code, remove dead branches and rename local variables, with 1 to 3 compress passes.
Fine-grained options
Drop console and debugger, keep function or class names, and protect specific identifiers.
ES target and modules
Pick ES2015, ES2017, ES2020 or ES2022 output and switch on ES module mode.
Source maps
Generate a .map file and a sourceMappingURL comment so minified code stays debuggable.
Size report
Original and minified bytes, percent saved and a gzip estimate for both.
Upload and download
Drop a .js file in, then copy the result or download it as .min.js.
How to Use
Add your code
Paste JavaScript into the input box, drop a .js file onto it, or press Sample.
Set the options
Tick Compress and Mangle, choose the comments to keep, the ECMAScript target and ES module mode.
Minify
Press Minify, or leave Minify as I type on. Check the size saved and any syntax error with its line and column.
Copy or download
Press Copy or Download .min.js, and download the .map file if you generated a source map.