100% FREE  -  NO SIGN-UP  -  YOUR FILES NEVER LEAVE YOUR DEVICE

JS Beautifier

Spread a minified or tangled script back out into readable code with the js-beautify engine. Choose a 2 space, 4 space or tab indent and read it like source again.

100% free, no premium plan No sign-up Files never leave your device
Drop your text here
or click to choose a file from your device

Your files are processed in your browser, on your own device. Nothing is uploaded to a server.

    A JS Beautifier spreads compressed or tangled JavaScript back out into lines a person can read. This one runs js-beautify in your browser at no cost and with no upload. Functions, loops and callbacks land at their proper depth, with a 2 space, 4 space or tab indent to pick from.

    How the JS Beautifier works

    js-beautify reads your script as a stream of tokens and rebuilds the line breaks and indentation from the structure it finds. Nested callbacks step inward level by level, chained calls settle onto readable lines, and the code keeps the exact same tokens in the exact same order.

    1. Paste JavaScript into the box, or drop a .js file onto the page.
    2. Choose an indent: 2 spaces, 4 spaces or a tab.
    3. Read the formatted output as it updates.
    4. Follow the indentation to find the function or branch you came for.
    5. Copy the formatted code, or download it as a .js file.

    Formatting changes whitespace and line breaks only. It never reorders statements, renames anything or rewrites expressions, so the code you get back runs the way the code you pasted in ran.

    When a JS Beautifier saves the day

    Reading someone else’s bundle is the classic case. A minified library file, a vendor script, or the one file a past developer left behind holds an answer you need: what a function does, where a setting lives, why a call fires twice. Spread out with real indentation, the file becomes a document instead of a riddle.

    Rescued code is the second case. JavaScript copied out of a browser console, lifted from a live page, or pasted from a ticket often arrives flattened or wrapped in odd places. Format it before it goes anywhere near your own project, so the file you keep is readable from day one. The CSS Beautifier and the HTML Formatter do the same rescue work for the other two languages in a page.

    Debugging is the quiet third case. Indentation is a debugging tool, not a cosmetic one, because a callback nested five levels deep, or a brace that closes one level too early, is visible at a glance once the lines spread out. When the code is understood and fixed, the JS Minifier packs it back down for shipping.

    JS Beautifier limits, honestly stated

    js-beautify works from tokens, not from a full parse of your program. That design is fast and forgiving, and it carries one hard limit: it cannot recover what minification destroyed. Variable names that were shortened stay shortened, and comments that were deleted stay deleted. Only a source map, used in browser developer tools, can reconnect the shipped code to the original names.

    Invalid code gets no clean error either. A parser would stop and complain, while a token-based formatter indents around its best guess. Broken JavaScript can come out looking oddly laid out instead of flagged. If the output reads strangely in one spot, that spot is a good place to run a syntax check on the input.

    TypeScript and JSX deserve a mention too. Type annotations and JSX markup can format imperfectly with a token-based tool that expects plain JavaScript. Plain JavaScript is the safe input here, and it is what this page is built for.

    Your code stays on your machine

    js-beautify runs inside your browser tab. Your code is never sent to a ToolPeko server, never stored and never read by anyone here. That holds for an internal script you would not paste into a stranger’s service just as much as for a public library file. There is no account, no sign-up and no formatting counter. Paste a snippet or a full bundle and the terms stay the same.

    FAQs

    Can it unminify variable names back to the originals?

    No. Minification replaced the names, and formatting only restores whitespace and line breaks. A source map in browser developer tools is the one route that reconnects shipped code to original names.

    Does beautifying change how the code runs?

    No. Formatting changes whitespace and line breaks only. Tokens, names and statement order stay exactly as they were, so the formatted file runs the way the pasted file ran.

    Why does my broken code look oddly formatted?

    The tool reads tokens and indents around its best guess instead of stopping with an error. Oddly laid out output is often the first visible sign that the input has a syntax problem worth checking.

    Which indent do most projects use?

    Two spaces is the common pick in web projects, with tabs a strong second. Match wherever the code will live, since consistency with the surrounding files matters more than the choice.

    Can I paste TypeScript or JSX here?

    You can, but type annotations and JSX markup can format imperfectly with a token-based tool. Plain JavaScript is what this page is built for, and it gives the cleanest results.

    Is my code uploaded anywhere?

    No upload happens. The formatting runs in your browser tab, and nothing is sent to or stored on a ToolPeko server.

    More Developer Tools

    Same rules as this one: free, in your browser, with nothing uploaded.

    Scroll to Top