JavaScript Formatter
Beautify and indent minified or messy JavaScript in your browser.
Examples
Beautify minified JavaScript
Input
function add(a,b){return a+b}const x=add(1,2);Output
function add(a, b) {
return a + b
}
const x = add(1, 2);Indent a nested block
Input
if(ok){run();done()}Output
if (ok) {
run();
done()
}About this tool
This free online JavaScript formatter turns messy or minified code into clean, neatly indented JavaScript — a fast JS beautifier and pretty-print tool. Paste your code, choose an indentation style, and the formatted result appears instantly. Everything runs in your browser with no upload, so your code never leaves your device.
How to use
- Paste your JavaScript into the input box (or click Sample to try it).
- Pick an indent of 2 spaces, 4 spaces, or a tab.
- Read the beautified code in the output box on the right.
- Copy the result with the Copy button.
When to use a JavaScript formatter
Beautifying is useful when you copy minified code from a bundle, debug a third-party script, or want to read a snippet before reusing it. Consistent indentation makes control flow and nesting obvious and keeps diffs clean.
Frequently asked questions
Is this JavaScript formatter free?
Yes — it's a completely free online JavaScript formatter and beautifier with no sign-up and no limits. Format and indent as much code as you like.
Is my code uploaded to a server?
No. This is a no-upload tool — your JavaScript is formatted entirely in your browser, so the code never leaves your device. It's safe for private or proprietary code.
What does the JavaScript beautifier do?
It re-indents your code, puts statements and blocks on their own lines, and normalizes spacing and braces, so minified or one-line JavaScript becomes readable again.
Can it un-minify JavaScript?
Yes — it expands minified, single-line JavaScript into a properly indented, readable layout. Note that it cannot restore original variable names that a minifier shortened.
Does it work with TypeScript or JSX?
It handles most TypeScript and JSX syntax for indentation and tidying. It's a beautifier, not a compiler, so it won't strip types or transform JSX — it just formats the text.
Does it validate my code?
It's a beautifier rather than a strict validator, so it formats best-effort even if there are minor issues. For catching real syntax errors, run your code through a linter or your editor.
Does it work offline and on mobile?
Once the page has loaded it runs locally, so it keeps working on a flaky connection, and the layout is fully responsive on phones and tablets.
Related tools