JS Minifier

Strip comments and redundant whitespace from JavaScript to reduce size. Remove line comments first.

The output will appear here.

How JS Minifier works

Strip comments and redundant whitespace from JavaScript to reduce size. Remove line comments first.

Input JavaScript
Output Minified JavaScript
Works done 3,893

Related tools

JS Minifier Details

JavaScript Minifier removes comments and redundant whitespace from JavaScript to cut the file size.

Use it to tidy a small script before inlining it in a page, or to squash a snippet onto one line.

The workflow

Short version: give it input, run it, take the output. Details below.

  1. Paste the JavaScript into the box.
  2. Run the tool; comments and extra whitespace are stripped.
  3. Copy the result.

Limits and processing behaviour

Minification behaviour:

  • Block comments are removed and runs of whitespace collapse to a single space.
  • Whitespace around braces, semicolons, commas and colons is dropped.
  • The code is processed in your browser, never uploaded.
  • Identifiers are not shortened; this is whitespace and comment cleanup only.

Picking the right tool

For a modest saving this page is enough. For a real production build, use the minifier in your own toolchain such as esbuild or terser.

IMPORTANT: single-line comments (double slash) are not removed. Because the code ends up on one line, such a comment turns everything after it into a comment and the script stops working. Convert or delete line comments before minifying.

Quick tips

  • Strip line comments first — that is this tool's known limitation.
  • Check the browser console for errors before shipping the output.
  • Server compression provides most of the real saving; treat minification as an extra step.

Data and privacy

This tool runs entirely in your browser, so what you type is not sent to the server. The only request that leaves is a counter with no content in it. Third-party advertising cookies may be present on the page, and they cannot read your input.

Frequently asked questions

Type or paste your data into the JavaScript field, run the tool, then copy or download the Minified JavaScript result.

Yes. While the text field is focused, Ctrl + Enter (Cmd + Enter on macOS) runs the tool.

You can copy the output or save it as a text file with the download button. The file name is based on the tool name.

The tool shows the error message in the output area. Fix the input and run it again.