Home โ€บ Developer Tools โ€บ JS Minifier

โšก JS Minifier

A conservative JavaScript minifier: strips comments and blank lines, shows bytes saved.

About this JS Minifier

This is a deliberately conservative JavaScript minifier. Instead of rewriting your code, it removes block comments, full-line and trailing line comments (while respecting quoted strings), blank lines and stray indentation, and keeps every statement on its own line so automatic semicolon insertion behaves exactly as before. You get a smaller file with zero surprises.

How to use it

  1. Paste your JavaScript into the Input box.
  2. Click Minify.
  3. Compare the byte counts shown below the output.
  4. Copy the result โ€” and always keep your original source for future edits.

Example

Two lines like // note followed by var a = 1; minify down to the single working line var a = 1; โ€” the comment is gone, the code is unchanged.

Frequently asked questions

Is this as small as a full minifier like Terser?

No. Production minifiers also rename variables and rewrite expressions. This tool only removes comments and whitespace, which is safer but saves less โ€” typically 10โ€“25%.

Can it break my code?

It is designed not to: it keeps line breaks and never touches the inside of quoted strings. Still, test the output, as with any build step.

Why keep each statement on its own line?

JavaScript sometimes relies on newlines to end statements. Joining everything into one line can change meaning, so this tool never does that.

More Developer Tools