Conservative and predictable
Only comments and whitespace that cannot change behaviour are removed. Variable names, function names and string contents are untouched, so the output is easy to reason about.
Remove comments and whitespace from JS without renaming identifiers.
Loading tool…
The tool is loading its code on your device. This happens once and is cached for later visits.
Processed entirely on your device
Overview
Minify JavaScript online with a conservative pass that strips comments and insignificant whitespace without renaming identifiers or altering behaviour. In-browser, no upload.
There are two things people call JavaScript minification, and it is worth being clear about which one this is. A full minifier parses your code into an abstract syntax tree, renames every local variable to a single letter, folds constants, drops unreachable branches and re-emits the smallest equivalent program. This tool does the safe half of that job: it removes comments and whitespace that cannot change what the code does, and leaves everything else exactly as you wrote it.
Renaming identifiers is powerful but fragile. It breaks code that reads function.name, that relies on a variable name matching a string used in reflection or dependency injection, or that shares a global with another separately minified file. A whitespace-only pass has none of those failure modes. The output is still recognisable, still debuggable and still greppable, which is exactly what you want for a snippet you are about to paste somewhere and forget.
The kept column is the hard part. A regular expression such as one matching a space, or a template literal spanning several lines, contains whitespace that is data rather than formatting. Stripping it would silently change behaviour, so the pass tracks those contexts and leaves them alone.
JavaScript infers semicolons from newlines in a few situations. Joining two lines carelessly can move where a statement ends and change the program. This is the classic reason a find-and-replace on newlines is not a minifier. A correct pass knows where a line break is load-bearing and keeps it, which is why the reduction is smaller than a real compiler achieves but the result is trustworthy.
For an application, use Terser, esbuild or SWC in your build. They produce source maps so minified stack traces still point at your original lines, and their renaming and tree-shaking cut far more than whitespace removal can. Use this tool for the small jobs: compressing an inline script, shrinking a bookmarklet, or checking how much of a file is just formatting.
Step by step
Paste your JavaScript into the input panel.
Press Minify JavaScript; comments and insignificant whitespace are removed.
Review the output — identifiers and logic are left exactly as written.
Copy the result or download it as a .js file.
Why use it
What this tool is good for, and what it deliberately does not try to do.
Only comments and whitespace that cannot change behaviour are removed. Variable names, function names and string contents are untouched, so the output is easy to reason about.
Because it never mangles identifiers, it cannot break code that relies on function.name, reflection, or names referenced across separately loaded files.
Whitespace inside string literals, template literals and regular expressions is preserved, which is where a naive whitespace-stripping pass corrupts code.
Proprietary or unreleased scripts are never sent to a server — the whole pass happens in the browser.
Questions
Short, honest answers about quality, limits and privacy.