JS Minifier
Minify JavaScript code to reduce file size.
Minify JavaScript with Terser, the minifier used by most build tools. Whitespace and comments are removed, code is compressed, and local variable names can be shortened. Tick ES module if the code uses import and export. Licence comments (/*!, @license, @preserve) are kept. If the code has a syntax error, you get its line and column instead of broken output. The size saving is shown, and the code never leaves your browser.
Common use cases
- Minify a small script for a website or a bookmarklet
- Shrink an embed code or widget
- Check how small a function can get
How to use
- Paste the JavaScript.
- Choose whether to shorten names and whether it's a module.
- Copy or download the result.
FAQ
Can minified code be turned back?
The layout can, with the JS formatter, but shortened variable names can't be restored. Keep your original source.
Does it support TypeScript?
No. Compile TypeScript to JavaScript first; Terser only reads JavaScript.
Related tools
- CSS MinifierMinify CSS code by removing whitespace and comments.
- HTML MinifierMinify HTML code by removing unnecessary whitespace.
- JSON FormatterFormat, validate, and beautify JSON data with syntax highlighting.
- SQL FormatterFormat and beautify SQL queries with proper indentation.
- XML FormatterFormat and indent XML documents for better readability.
- HTML FormatterBeautify HTML code with proper indentation and formatting.