JavaScript Minifier & Beautifier
Minify JavaScript by removing comments and whitespace — never renaming or dropping code, ASI-safe — or beautify it with clean indentation. No upload.
Smaller (or neatly indented) JavaScript that runs exactly as before, with bytes saved, comments removed and every line break kept for semicolon insertion listed honestly.
Example: Fourteen lines with comments, template literals and a regex literal become one line plus six kept breaks where the code relied on automatic semicolons; add the semicolons and it is a single line.
Lexical, not clever —
so it cannot break your code.
Why this minifier only touches comments and whitespace, how it decides which line breaks must stay, and what the beautifier does.
What minify does
The source is split into tokens — strings, template literals (with nested ${…}), regular-expression literals, comments, numbers, words and punctuation. Comments are dropped unless they start with /*! or contain @license or @preserve. Whitespace is dropped except where two tokens would merge into a different one (return x, a + +b, 1 .toString()). Nothing is renamed, inlined, folded or removed, so the output is the same program; a real compiler (terser, esbuild) will get smaller files by doing exactly those things.
Line breaks and ASI
JavaScript inserts a semicolon at some line breaks (ECMA-262 §12.10). Removing such a break can change meaning — "return⏎x" returns undefined, "a = b⏎(c)()" is a call. The minifier keeps a line break unless the token before it or after it makes a semicolon impossible there (after ; { , ( [ or an operator; before ) ] } ; , . or an operator). Every kept break is counted; write semicolons in the source and the output becomes one line.
Beautify and limits
Beautify re-indents by brace depth, puts one statement per line where a semicolon or brace occurs, spaces keywords, commas and binary operators, and keeps your own line breaks otherwise — it does not parse, so it will not reflow long expressions. TypeScript is handled as tokens (types pass through); JSX is not understood and is flagged. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.
SOURCES
Last reviewed 20 September 2026. How results are checked: How we verify.