Compress JavaScript with Terser for a smaller file, or validate code and see syntax errors with their line numbers.
About the JavaScript Toolkit
Compresses (minifies) JavaScript, with optional variable-name mangling and compression passes, and validates code for syntax errors and likely problems.
How to use it
Paste your JavaScript or upload a .js file.
Choose the ECMAScript version to target, from ES5 to the latest.
Click Compress to minify the code, or switch to Validate to check it for syntax errors.
Copy or download the minified output.
Good for
Shrinking a small script before embedding it in a page
Checking a snippet for syntax errors before deploying
Quick experiments without setting up a build tool
Tip: Keep the original readable file in version control and treat the minified output as a build artifact. Mangling names can break code that relies on function or variable names at runtime.
Frequently asked questions
What does minifying JavaScript do?
It removes whitespace and comments and shortens code so the file downloads faster, without changing what the code does.
Does validation run my code?
No. The validator only parses the code to find syntax errors; it never executes it.
Should I edit the minified file?
No. Keep the readable source in version control and treat the minified output as a build artifact.