Skip to main content

JavaScript Minifier

Minify JavaScript with terser: shorter code, an optional source map and a before and after size including gzip. Private, in your browser.

JavaScript

Stays in your browser

Result

The result appears here.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JavaScript Beautifier or HTML Minifier.

Free Online JavaScript Minifier

Make a JavaScript file smaller for production. Paste your code, press Minify and copy or download the result with the size you saved. It gives developers a quick browser-based way to solve a focused javascript minifier task before moving the result into a project.

How to use the javascript minifier

Paste your code in the box, adjust the options if you want, and press Minify. Mangling shortens variable and function names, compressing rewrites code into smaller equivalent forms, and a source map lets browser tools show your original code. Everything runs in your browser.

Common mistakes

  • Keep the original file: minified code is not meant to be edited or read.
  • Test the result before you ship it, especially if the code relies on function names or comments.
  • Minify modules and scripts separately: the tool treats the text as one script.

Frequently asked questions

Is the minified code safe to use?
Minifying keeps the behaviour of your code. Mangling renames local names, so code that depends on function names (for example reading fn.name) needs "Keep function names". Always test the output.
What is a source map for?
It maps the minified code back to your original lines so browser developer tools can show readable code and the right line numbers for errors.
Is my code uploaded?
No. The minifier runs in your browser and nothing you paste is sent anywhere.
How do I use this javascript minifier tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Formatters & Parsers

View all Formatters & Parsers tools →