JavaScript minifier
Paste JavaScript, choose whether to mangle names and drop console calls, and get production-ready output with the byte savings shown.
Powered by Terser (ES2020+ supported). Runs entirely in your browser.
How to use it
- Paste JavaScript into the left box. Modern syntax (ES2020 and later, including classes, async functions and optional chaining) is supported.
- Leave Mangle names on to shorten local variable and function names. Turn on Drop console.* to strip logging.
- Click Minify JS. If there is a syntax error, the message shows the line and column.
What Terser does to your code
- Removes whitespace and comments (license comments starting with
/*!are kept by default in most builds; check the output if you must preserve them). - Mangles local names:
function add(first, second)becomesfunction add(d,n). Global names and object properties are left alone so your code keeps working. - Compresses: removes unreachable code, inlines constants and simplifies expressions.
When to use an online minifier
Your bundler should minify production builds (Vite and webpack use esbuild or Terser under the hood). An online minifier is useful for one-off scripts: a tag manager snippet, a CMS embed, a bookmarklet, or a quick check of how small a file can get.
Minification is not obfuscation
Minified code is harder to read but easy to reformat. Never put secrets such as API keys in client-side JavaScript, minified or not.
FAQ
Is my code uploaded?
No. Terser runs in your browser tab.
Will minifying break my code?
Not if the code is valid and does not depend on function or variable names at runtime (for example, reading fn.name). If something breaks, turn off name mangling and try again.
Does it support TypeScript or JSX?
No. Compile TypeScript or JSX to JavaScript first, then minify the output.
Is it free?
Yes. All tools at ryzlabs.com/tools are free with no sign-up.
Need senior JavaScript engineers on your team?
Ryz Labs places senior JavaScript, TypeScript and React engineers who work in your codebase and report to your leads, on US business hours.
Start a conversation →