JS Minifier
Minify JavaScript in your browser with Terser, with before/after byte sizes, percent saved and clear syntax errors.
Runs in your browser Your input never leaves your device.
About this tool
Paste JavaScript and get a minified version using Terser, running entirely in your browser. It removes comments and whitespace, compresses expressions and can rename local variables (optional). You see the size before and after in bytes and the percentage saved. Syntax errors are shown with the line and column. There is an option to treat the code as an ES module. Top-level names are not renamed, so global functions keep working. Always test minified code before shipping.
How to use it
- Paste your JavaScript into the input box.
- Choose whether to rename local variables or treat the code as an ES module.
- Press Minify.
- Copy the output and check the byte sizes.
Common problems
- Syntax error shown
- Fix the reported line and column. If the code uses import or export, tick "Treat as ES module".
- Output behaves differently
- Untick "Rename local variables" and retest; code that depends on function or variable names can break when they are renamed.
- Very little size saved
- Code that is already minified or has few comments and little whitespace has little left to remove.