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

JavaScript Escape / Unescape

Turn text into a safe JS string literal, or unescape it back.

JavaScript
Open Tool

HTML Formatter

Indent and tidy HTML, or minify it.

HTML
Open Tool

CSS Formatter

Beautify minified CSS into readable rules, or minify it.

CSS
Open Tool

JSON Formatter

Beautify, minify and validate JSON instantly in your browser.

JSON
Open Tool

HTML Minify

Remove comments and extra whitespace from HTML safely.

HTML
Open Tool

CSS Minify

Shrink CSS by removing comments and spaces, keeping it valid.

CSS
Open Tool

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

  1. Paste your JavaScript or upload a .js file.
  2. Press Beautify.
  3. 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

Input
const add=(a,b)=>{return a+b};console.log(add(2,3));
Output
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.