Minify JavaScript
Minify JavaScript with Terser: remove comments and whitespace and shorten names. Free, in your browser.
In your browser
Minified …
Top-level names are left alone, so code that other scripts call (like chart_options) keeps working.
Also with the javascript minifier
About this tool
Shrink a JavaScript file for production. Comments and whitespace are removed, local names are shortened and code is simplified, all in your browser.
How to use it
- 1 Paste your JavaScript.
- 2 Choose whether to shorten names and optimise code.
- 3 Copy or download the minified output.
Questions
Will minifying break my code?
Not normally. Top-level names are kept so other scripts can still call them. Test the output before deploying.
Is my data uploaded?
No. This tool runs in your browser, so your text and files never reach our server.
Is this tool free?
Yes. It’s free to use with no sign-up and no limits for normal use.
More in Code & markup
- HTML minifier Remove comments and collapse whitespace in HTML.
- CSS minifier Remove comments and unnecessary whitespace from CSS.
- SQL beautifier Format SQL so each clause starts on its own line.
- Markdown to HTML Convert Markdown (GitHub-flavoured) to HTML.
- BBCode to HTML Convert forum BBCode ([b], [url], [img]…) to HTML.
- JSON to TypeScript New Generate TypeScript interfaces from a sample JSON object.