Updated 2026 · By ToolFern

JavaScript Minifier

Paste your JavaScript and get a smaller, single line version back. This tool strips commentsand collapses extra whitespace to shrink your JS for the web, all100% in your browser.

How to use it

  1. Paste your JavaScript into the input box. A full file or a small snippet both work.
  2. Press Minify, or just keep typing, the output updates live as you go.
  3. Check the stats line to see how many bytes you saved, then press Copy to grab the result.

How it works

Minifying makes a file smaller so it downloads faster and uses less bandwidth. This tool does it in two simple, reliable steps. First, it removes comments, both /* block comments */ and// line comments, since the browser does not need them to run your code. Second, itcollapses runs of whitespace and newlines into single spaces and trims the edges, so all the indentation and blank lines that make code readable for humans are stripped out for the machine.

The byte sizes shown in the stats line are measured the same way a server would count them, so the percentage you see reflects the real saving on the wire.

A basic minifier, not a full compressor

This is a basic minifier. It removes comments and extra whitespace, but itdoes not rename variables, fold constants, drop dead code or do any of the deeper transformations a real compiler performs. For a production build you should use a full tool likeTerser, which is built into most bundlers and compresses far more aggressively while keeping your code correct. Think of this tool as a quick way to trim a snippet, not a replacement for your build pipeline. Because everything runs locally, your code is never uploaded, which keeps any keys or logic private.

Frequently asked questions

Is my code sent anywhere?

No, it is minified in your browser and never uploaded.

Does it rename variables?

No, it only strips comments and extra whitespace. For that, use a full tool like Terser.

Will it break my code?

For most scripts the logic is unchanged, but always test the output before shipping.

How much will it shrink?

It depends on your comments and indentation. The stats line shows the exact saving.

Related: JSON Formatter