JavaScript minifier
Minify JavaScript onto one line with Terser: strips comments and spaces, shortens local names and simplifies code.
In your browser
Minified …
Top-level names are left alone, so code that other scripts call (like chart_options) keeps working.
Next in your workflow
Popular uses
About this tool
Shrink JavaScript for production with Terser, the same minifier used by modern build tools. It shortens local names and simplifies code, and top-level names stay intact.
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.
- GitHub profile README generator New Build a GitHub profile README with stats, streak, tech stack icons, trophies and live preview.
- Markdown to HTML Convert Markdown (GitHub-flavoured) to HTML.
- BBCode to HTML Convert forum BBCode ([b], [url], [img]…) to HTML.