J↓JavaScript Minifier
Light JavaScript minifier — strips comments and extra whitespace.
This strips comments and collapses whitespace. It does not rename variables, remove dead code, or restructure anything — and that omission is deliberate.
Those transformations are where the real size savings live, and they are also where naive minifiers break code. Doing them safely requires actually parsing the JavaScript: understanding scope, knowing which names are safe to shorten, recognising what is reachable. A regex-based tool that attempts it will eventually meet a construct it misreads, and the failure will be silent until production.
So treat this as a light, safe reduction for a standalone script, not a replacement for a build tool.
If your minified script throws errors
The usual cause is automatic semicolon insertion. JavaScript infers semicolons at line breaks in specific situations, so code written in a style that omits them is fragile under any whitespace change. Remove the line breaks and two statements merge into one.
If you write without semicolons, minify carefully and test properly — or add them, which costs nothing.
Use a bundler for anything real
esbuild, Terser, or whatever your framework ships with will do this better and handle modules, tree shaking and source maps as well. Source maps in particular matter: without them, a production error report points at line 1, column 8400, which tells you nothing.
Minifying is not protection
Anything you ship to a browser can be read. A formatter reverses most of this in about a second, and browser devtools will pretty-print it for you automatically.
Obfuscation — the deliberate kind that mangles names and inserts junk — goes further, costs runtime performance, and still does not stop a determined reader. If logic genuinely needs to stay private, it belongs on a server.
This tool is provided free of charge for general information and convenience only. It runs in your browser and we do not store the data you enter. We make no guarantee as to the accuracy, completeness, or suitability of any result, and accept no liability for any loss, damage, or decision arising from its use — use it at your own risk. See our Terms & Conditions.