JavaScript Minifier

Minify modern JavaScript locally with Terser, without executing code or renaming your variables.

✓ Free to use · Runs in your browser · No sign-up

Make your code smaller

Paste source code, then select Minify. The output is text only: your code is never run.

Removes formatting without renaming variables or applying compression transformations. JavaScript only; TypeScript and JSX need compilation first. License comments are kept.

Your data is processed locally in your browser and is not uploaded to our servers.

Up to 100,000 characters. Paste text, not a file URL.

How to use JavaScript Minifier

  1. Paste plain JavaScript source into the input box.
  2. Select Minify to load the local Terser parser and generate compact source.
  3. Review sizes and syntax errors, then copy or download the .js result.

A closer look

JavaScript cannot be safely minified by stripping whitespace with regular expressions. Strings, template literals, regex literals, automatic semicolon insertion, and modern syntax all affect meaning. Terser parses the program and prints a compact representation. This tool disables variable mangling and compression transformations, preserving names and avoiding assumptions about how your code is used. It supports modern JavaScript such as arrow functions and async/await; TypeScript and JSX should be compiled before input. The source is parsed as data and never executed.

A practical example

Compact const total = 2 + 3; without executing it. Variable names remain intact; this tool does not bundle imports or compile TypeScript.

A useful tip

Keep the original source for editing and run your own application tests before shipping any generated file. Comments beginning with ! or containing @license or @preserve are retained. The tool does not generate source maps or bundle imports.

Good questions. Simple answers.

Why is the size reduction smaller than a production bundler’s?

This tool removes formatting conservatively. It does not rename variables, remove unused code, merge modules, or apply compression rewrites.

Will minification run my code or resolve imports?

No. Terser reads the source without evaluating it. Import paths remain in the output and are not fetched.

Explore all developer tools for related tasks and category-specific guidance, or read how Toolzafi handles your data.

A few more useful tools