Beautify minified or messy JavaScript and JSX with Prettier, at your indent and width
Make minified or hand-written JavaScript readable: statements on their own lines, consistent spaces and semicolons, JSX laid out like React code.
How to use it
Paste JavaScript, or open a .js, .mjs or .jsx file. Choose the indent and type any line width from 20 to 320; long calls and objects break across lines beyond it. Under Options, set semicolons, quotes, trailing commas, bracket spacing, arrow parens, quoted keys and how objects wrap, as in a .prettierrc. Copy or download formatted.js. Code that can’t be read gets its line and column, marked in your text.
Examples
Minified code, readable again
function add(a,b){return a+b}const total=add(1,2);console.log(`total: ${total}`)function add(a, b) {
return a + b;
}
const total = add(1, 2);
console.log(`total: ${total}`);A React component in JSX
const List=({items})=><ul>{items.map(i=><li key={i.id}>{i.name}</li>)}</ul>const List = ({ items }) => (
<ul>
{items.map((i) => (
<li key={i.id}>{i.name}</li>
))}
</ul>
);A bracket left open
const price = (19.99;
Line 1, column 21Unexpected token, expected ","
Formatted by Prettier’s rules
Large bundles
Questions
- Does it read TypeScript?
No: type annotations stop with an error at their line. JavaScript, JSX and newer syntax like optional chaining, private class fields and top-level await are read. - Can it undo obfuscation?
No. It lays the code out readably, but names, string tricks and packed code stay what they are. It doesn’t run the code it reads. - Is my code uploaded?
No. Everything runs in your browser, so your code stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. Scripts can hold API keys, and the page warns you if it spots one.