Skip to content

Minify JavaScript online

Paste JavaScript to strip comments and collapse whitespace. Strings, template literals and regular expressions are detected and left untouched.

Minified output
This is a conservative, rule-based minifier: it removes comments and extra whitespace without renaming variables or rewriting code. It is safe for everyday use, but a full bundler (like Terser or esbuild) shrinks production code further.

Your text is processed in your browser as you type. It is not sent to ToolsNest servers or stored after you leave the page.

How to use the JavaScript Minifier

  1. 1Paste your JavaScript.
  2. 2Read the minified output and size saving.
  3. 3Copy the result.

Supported formats and limits

  • Removes // and /* */ comments and collapses safe whitespace.
  • Strings, template literals and regex literals are preserved.
  • Does not rename variables — for that, use a full bundler like esbuild or Terser.

Common uses

  • Shrinking a small script for a static page.
  • Cleaning code before embedding it.
  • Understanding what minifiers remove.

Frequently asked questions

Is this safe for production?

It is conservative by design, but for production bundles a dedicated tool with full parsing is the right choice. Always keep your original source.

Related tools