FOR WEB DEVELOPERS

JavaScript Minifier

Minify JavaScript with Terser: remove whitespace and comments, shorten variable names and drop unreachable code. Free and private.

Code stays on your device

1 Your JavaScript

Processed in your browser. Nothing is uploaded.
THREE SMALL STEPS

How to minify JavaScript

  1. 01

    Paste your script

    Paste modern JavaScript, including arrow functions, classes and async code.

  2. 02

    Set the options

    Choose whether local names are shortened, keep license comments, and tick ES module when the code uses import or export.

  3. 03

    Download the result

    Select “Minify JavaScript”, then copy the code or download it as script.min.js.

BEFORE YOU START

Good to know

Errors show the line

If the code cannot be read, the message gives the line and column of the problem so you can fix it in your source.

Global names are kept

In a regular script, top-level functions and variables keep their names so other scripts on the page can still call them.

Not a way to hide code

Minified code is harder to read but anyone can reformat it. Never rely on it to hide API keys or other secrets.

QUESTIONS

Frequently asked questions

What is the difference between minifying JavaScript and gzipping it?

Minification changes the source representation by shortening code where possible. Gzip compresses the response bytes during transfer and is reversed by the browser. A website can use both; this tool produces minified JavaScript, not a gzip archive.

What does the ES module option change?

It allows import and export statements, applies strict mode and lets the minifier also shorten top-level names, which is safe inside a module.

Does it support TypeScript or JSX?

No. Compile TypeScript or JSX to JavaScript first, then minify the compiled output.

Will the minified script behave the same?

It should for standard code. Code that reads function or class names at runtime can break when names are shortened, so turn off “Shorten names” in that case.