Search tools

JavaScript Minifier

Compress JavaScript with Terser, the minifier used by modern build tools — right in your browser.

JavaScript Minifier tool

Options

Processing runs in your browser.

Minified JavaScript downloads and parses faster, especially on mobile. Most projects minify in their build pipeline, but for a single script, a bookmarklet, a snippet for a tag manager or a quick size check, running a build tool is overkill. This tool gives you the same result in seconds.

Uses

  • Bookmarklets that must fit in one line.
  • Tag manager and CMS snippets where size and line breaks cause trouble.
  • Legacy sites without a build step.
  • Comparing size before and after a refactor.

How to use the JavaScript Minifier

  1. Paste JavaScript or open a .js file.
  2. Keep Shorten variable names on for the smallest output.
  3. Tick ES module if the code uses import or export.
  4. Copy the result or download it as a .min.js file. Syntax errors show the line and column.

Features

  • Terser, the same minifier behind webpack, Vite and Rollup production builds.
  • Dead-code removal, constant folding and two compression passes.
  • Optional name mangling of local variables and functions.
  • Keeps comments starting with /*! or containing @license or @preserve.
  • Modern syntax: arrow functions, classes, async/await, optional chaining.

Frequently asked questions

Will minification break my code?

Not if the code is valid. Terser only renames local variables, never global names or object properties. Code that relies on function.name or on eval may behave differently with name mangling on — switch it off in that case.

Is minified code secure or hidden?

No. Minification is not obfuscation; it makes code smaller, not secret. Anyone can reformat it with a beautifier. Never put secrets in front-end code.

Does it create source maps?

No. For production apps, use a build tool that outputs source maps alongside the minified file so errors can be traced back to the original code.

Written by