About JavaScript Minifier
Minifies JavaScript in-browser using Terser, the industry-standard JS compressor. Supports three independent options: mangle (renames local variables and function parameters to single letters), compress (constant folding, dead code elimination, and other peephole optimizations), and comment stripping. Shows original size, minified size, bytes saved, and reduction percentage after each run.
- Runs entirely in the browser — no code is uploaded to any server
- Mangle renames local identifiers to short names (a, b, c…) to reduce byte count without changing behavior
- Compress applies Terser's full optimizer: constant folding, dead code removal, inline functions, and more
- Comment stripping removes both line (// ...) and block (/* ... */) comments from the output
- Terser is ES2022-aware and handles modern syntax including async/await, optional chaining, and nullish coalescing
- Error messages include line and column info when Terser encounters a syntax error in the input
Frequently Asked Questions
- Is it safe to minify production code here?
- Yes — minification runs entirely in your browser using WebAssembly. No code leaves your machine. You can verify this by opening DevTools and checking the Network tab.
- Will mangling break my code?
- Mangling is safe for self-contained scripts. It renames local variables and function parameters, not exported names or global assignments. If your code relies on properties accessed by string (e.g. obj["myProp"]), those are not renamed. For bundled code, use a build tool like esbuild or Webpack which understands module boundaries.
- How does this compare to esbuild or Webpack?
- This tool handles one-off snippets and quick size checks. Build tools integrate minification into a pipeline with tree-shaking, bundling, and source maps. For production deployments, prefer a build-time tool. For quick paste-and-minify tasks, this is faster.