JavaScript Beautifier
Pretty-print minified or messy JavaScript with consistent indentation and line breaks so it is easy to read and debug — in your browser.
Suggested tools
About JavaScript Beautifier
JavaScript Beautifier makes minified or messy JavaScript readable again — consistent two-space indentation, one statement per line and properly laid-out functions, objects and arrays. It is essential for debugging production bundles, reviewing third-party scripts or learning from other people's code.
Formatting is done by js-beautify, the same engine behind many editors and the well-known online beautifiers. Everything runs locally in your browser — the text you paste is never uploaded.
How to use JavaScript Beautifier
- Paste your JavaScript or upload a .js file.
- Press Beautify.
- Copy or download the formatted code.
Key features
- Readable layout for minified bundles
- Handles modern syntax: arrow functions, classes, async/await, template literals
- Two-space indentation
- Powered by js-beautify
Example
const add=(a,b)=>{return a+b};console.log(add(2,3));const add = (a, b) => {
return a + b
};
console.log(add(2, 3));When to use JavaScript Beautifier
- Reading a minified script while debugging a website.
- Reviewing a third-party script before adding it to your site.
- Tidying code copied from a chat or a forum.
Tips and common problems
- Use your browser's developer tools "pretty print" button for scripts loaded on a page.
- Source maps, when available, give back the original file names and variable names.
- Beautifying never runs your code — it only changes the layout.
Frequently asked questions
No. Minifiers shorten names like userCount to a; beautifying restores the layout but cannot know the original names. Source maps, if available, are the way to get them back.
Simple TypeScript and JSX often format acceptably, but for full support use Prettier in your editor.
No. The code is only re-formatted as text; it is never run.