Free tools, no sign-up — everything runs in your browser.
ToolHub 1000Free online tools

JavaScript Minifier

Remove comments and collapse whitespace in JavaScript, with basic string protection.

Quick answer: enter your details below and click Minify JavaScript — your result appears instantly, right here in your browser. Nothing you enter is uploaded or stored.
J
Developer

Enter your details below.

How to use

  1. Paste your JavaScript into the box.
  2. Click Minify JavaScript.
  3. Check the compact result before using it in production.

About this tool

This tool strips line and block comments and collapses runs of whitespace, then trims spaces around braces, brackets, parentheses, semicolons and commas. Quoted strings, including template strings, are protected first so their contents are not altered. It is a basic minifier: it does not rename variables, remove dead code or handle every edge case, and regular expressions containing comment-like text can still confuse it, so check the result before shipping it.

Frequently asked questions

Does it rename variables?

No. Names are left exactly as written; only comments and whitespace are removed.

What can still go wrong?

Regular expressions that look like comments, and other unusual syntax, can confuse a basic minifier. Treat the output as a draft and test it.

Related tools

All tools · Read the guide: JavaScript Minifier