JavaScript beautifier
Format minified or messy JavaScript and JSON-like code.
About the JavaScript Beautifier tool
This JavaScript beautifier reformats JS with consistent indentation, spacing and line breaks, which makes minified bundles and one-line snippets readable again. You can choose 2 spaces, 4 spaces or tabs, and whether opening braces stay on the same line or move to the next. It uses the js-beautify library, never runs your code, and cannot bring back variable names that a minifier shortened. Open .js, .mjs or .cjs files up to 20 MB, or paste code copied from browser DevTools.
At a glance
- Indent
- 2 spaces, 4 spaces or tabs
- Braces
- Same line or next line
- Method
- js-beautify; code is treated as text and never run
- Output
- script.js; .js, .mjs and .cjs files up to 20 MB
- Price
- Free, no sign-up
- Works in
- Your browser, on phone or computer. Works offline after the first visit.
- Privacy
- What you type never leaves your device.
How to beautify JavaScript
- Paste your JavaScript or open a .js file.
- Pick the indent and brace style.
- Copy the formatted code or download it.
Private
Your text stays in your browser and is never sent to a server.
Instant
Results update as you type, with nothing to install.
Free
No sign-up, no limits and no ads inside your writing space.
JavaScript Beautifier: frequently asked questions
Can it restore the original variable names of minified code?
No. Minifiers rename variables to short names like a and b, and that information is gone. Beautifying restores the layout, not the names.
Does it check my code for errors?
No. It formats code without running or validating it, so broken code is formatted as well as it can be. Use your editor or linter to find syntax errors.
Is my code run or uploaded?
No. The code is only treated as text and formatted in your browser. It is never executed and never leaves your device.
Can I beautify JSON with the JavaScript beautifier?
Yes. JSON is valid JavaScript, so {"a":1,"b":[2,3]} is indented the same way as code. If you also need to know whether the JSON is valid, use the JSON formatter, which reports errors.



