Developer Tools

JavaScript Minifier

Remove comments and collapse whitespace from JavaScript code — browser-only, no uploads.

No uploads — browser onlyInstant result

JavaScript Input

How to minify JavaScript

  1. Paste your JavaScript code into the input area.
  2. Click Minify JavaScript.
  3. Copy the minified output — the size savings are shown above the result.

Privacy — processed in your browser

Minification runs entirely in your browser using JavaScript string processing. Your code never leaves your device — no server call, no data collection.

Frequently Asked Questions

What does this JS minifier do?

It removes single-line (//) and multi-line (/* */) comments, collapses runs of whitespace and newlines to single spaces, and strips spaces around common punctuation like braces and commas.

Will it rename variables to shorter names?

No — this is a whitespace-only minifier. It does not parse an AST or rename identifiers. For full dead-code elimination and variable mangling, use a build tool like esbuild, Terser, or Rollup.

Can it break my code?

Conservative whitespace removal should be safe. However, regex literals and certain edge cases with template literals or unusual whitespace-dependent code could be affected. Always test minified output.

What file size savings can I expect?

Typically 15–40% depending on how heavily commented and whitespace-padded the original code is. A full minifier with variable renaming can achieve 50–70%.

Related tools