Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

JavaScript Formatter

JavaScript

Paste JavaScript, or

CtrlV paste · Ctrl↵ run now

Formatted JavaScript
Ready
Ln 1, Col 1
Runs in your browser. Nothing you paste is uploaded unless you share it.

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

  1. Paste JavaScript, or open a .js, .mjs or .jsx file.
  2. 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.
  3. 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

Input
function add(a,b){return a+b}const total=add(1,2);console.log(`total: ${total}`)
Result
function add(a, b) {
  return a + b;
}
const total = add(1, 2);
console.log(`total: ${total}`);

A React component in JSX

Input
const List=({items})=><ul>{items.map(i=><li key={i.id}>{i.name}</li>)}</ul>
Result
const List = ({ items }) => (
  <ul>
    {items.map((i) => (
      <li key={i.id}>{i.name}</li>
    ))}
  </ul>
);

A bracket left open

Input
const price = (19.99;
Result

Line 1, column 21Unexpected token, expected ","

Formatted by Prettier’s rules

Prettier reads the code and prints it again in one consistent style, so the result looks the same however the input was written. Names and comments stay as they are, strings take double quotes unless that needs more escapes, and semicolons are added where JavaScript would insert them anyway, so the code runs the same. Options sets the same choices Prettier’s config does: semi, singleQuote, trailingComma, bracketSpacing, arrowParens, quoteProps and objectWrap.

Minified names like a, b and e stay short: formatting can’t know the names they had before. Source maps, if your build has them, are where the original names live.

Large bundles

Up to 10 MB is formatted a few statements at a time in a background thread, so typing and scrolling keep up. A single statement over 500 KB, as some bundles are one giant function, is left as written with a note: formatting it would need too much memory on a phone.

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.

Related tools