Minify JavaScript to cut file size, or beautify minified code back to readable. Runs entirely in your browser — your code never leaves the page.
This JavaScript Minifier and Beautifier does two jobs in one place: it shrinks JS by stripping out everything a browser does not need to run it, and it pretty-prints minified or one-line code back into readable, indented source. Paste code on the left, click a button, and the result appears instantly with a live byte count and percent saved.
Minifying strips single-line and block comments, collapses runs of whitespace and newlines, removes spaces around operators, brackets, and punctuation, and tidies redundant semicolons before closing braces. String literals, template literals, and their embedded expressions are scanned and left untouched, so escape sequences and interpolated values survive intact. Beautifying reverses the squeeze: it walks the code, tracks brace depth, and re-indents statements onto their own lines with consistent two-space nesting. Both directions handle modern ES6+ syntax — arrow functions, classes, async and await, template strings, and optional chaining all pass through cleanly. People use it to:
This is a fast, lightweight whitespace-and-comment minifier rather than a full optimizing compiler — it does not rename variables, eliminate dead code, or restructure logic, so for production bundles reach for esbuild, Terser, or SWC. Everything runs locally in your browser: the code you paste is never uploaded or sent to any server, so you can clean up private or proprietary scripts with complete confidence.
It is great for quick, one-off shrinking — strips comments, collapses whitespace, and removes redundant semicolons. For full mangling (variable renaming, dead-code elimination) use a build tool like esbuild, Terser, or SWC.
Yes. Template literals, arrow functions, classes, async/await, optional chaining — all preserved. String and template-literal content is left untouched so escape sequences and embedded expressions stay intact.
No. The minifier and beautifier run 100% in your browser. Nothing is transmitted — paste freely.
Minifying strips single-line and block comments, collapses runs of whitespace and newlines into single spaces, removes spaces around operators, brackets, and punctuation, and tidies redundant semicolons before closing braces. The logic of your code is unchanged — only characters a browser does not need are removed.
Minify makes code smaller by stripping comments and whitespace so it loads faster. Beautify does the opposite: it walks the code, tracks brace depth, and re-indents statements onto their own lines with consistent two-space nesting so minified or one-line JavaScript becomes readable again.
It is safe for quick, one-off shrinking and does not rename variables or change names. This is a whitespace-and-comment minifier, not a full mangler — it never touches your identifiers, restructures logic, or removes dead code. String and template-literal content is left intact, so embedded expressions and escapes survive.
It depends on how many comments and how much whitespace your code has — heavily commented or indented files shrink more. The stats bar shows the exact input size, output size, and percent saved after each run so you can see the real result for your file rather than a guess.