JavaScript Formatter & Minifier
Beautify common JavaScript source formatting or remove safe whitespace.
Lightweight formatter; not a full JavaScript parser.
How the JavaScript formatter works
Paste your JavaScript
Add a script or code snippet into the input box.
Format or minify
Format adds line breaks around braces and statements for readability. Minify collapses whitespace for a smaller file.
Copy the output
Copy the result for use in your project or code editor.
Frequently asked questions
Is this a full JavaScript parser?
No. It's a lightweight formatter, not a full parser, so it works best on reasonably standard, well-formed JavaScript rather than unusual syntax.
Will minifying rename my variables?
No. Minifying here only removes unnecessary whitespace; it does not rename variables or perform advanced optimizations the way a build-tool minifier would.
Is my code uploaded anywhere?
No. Formatting and minifying run locally in your browser.