Developer Tools

Free Online JavaScript Minifier

Paste your JavaScript code below to safely minify it using Terser — a trusted, widely used minification engine — entirely in your browser.

Minification is powered by Terser, an open-source JavaScript minifier, loaded only on this page.

How to use the javaScript Minifier

  1. Paste your JavaScript code into the input box.
  2. Click 'Minify JavaScript'.
  3. If there's a syntax error, it will be shown instead of broken output.
  4. Compare file sizes and copy the minified result.

Example

Minifying a function like function add(a, b) { return a + b; } produces a much shorter equivalent such as function add(a,b){return a+b}, with identical behavior.

Why minify JavaScript?

Smaller JS files download and parse faster, directly improving page load performance. Minification removes whitespace, comments, and shortens variable names without changing what the code does.

Powered by Terser, not a naive regex

Safely minifying JavaScript requires actually understanding its syntax — a simple find-and-replace can easily break strings, regular expressions, or template literals. This tool loads Terser, a well-established open-source minifier, to do the job correctly.

Frequently asked questions

Terser handles standard modern JavaScript reliably; extremely unusual or experimental syntax may occasionally not be supported.

The tool reports the error instead of producing minified output, so you can fix the code first.

Yes, by default Terser shortens variable names where safe to do so, which is part of what reduces file size.

No, minification runs using Terser loaded in your browser; your code is never sent anywhere.