How to minify JavaScript
- Paste your JavaScript.
- Choose whether to shorten names and keep license comments.
- Copy the result and check the size saved.
About this tool
Make JavaScript smaller for production with Terser. It removes comments and spaces, shortens local variable names and simplifies code where the result is the same. You see the size before and after. A syntax error is reported with its line and column. Your code stays in the browser.
Common questions
Is minified code safe to use?
It behaves the same as the original in normal cases. Turn off name shortening if other code looks up your function or variable names by text.
How do I keep a license comment?
Tick the license option. Comments that start with /*! or contain @license are kept.
Will it work on ES modules?
Yes. Import and export statements are supported.
Is it free to use?
Yes. There's no sign-up, and you can use it as often as you like.
Is my text uploaded anywhere?
No. This tool runs inside your browser, so what you enter stays on your device.
Do I need to install anything?
No. It works in your browser on a computer or a phone.