Developer Tools Runs in your browser Free · no account

JavaScript Formatter

The JavaScript formatter tokenises code and re-emits it with consistent indentation and line breaks. Because it only changes the whitespace between tokens, string literals, template literals, regular expressions and comments come through byte for byte.

Options
JavaScript 0 characters
Formatted JavaScript

Your result will appear here.

Not sure where to start? Use Load example.

Results update automatically and are calculated on your device. Nothing you type is sent to a server.

Runs in your browser. Processing happens entirely in your browser. Nothing you enter is sent to Delimiter.live.

How to use the JavaScript Formatter

  1. Paste minified or badly formatted JavaScript.
  2. Choose an indent width.
  3. Copy or download the readable version.

Example

Input
function a(){return 1}
Output
function a() {
  return 1
}

Common use cases

  • Reading a minified bundle to work out what a third-party script does.
  • Tidying a snippet pasted from a tutorial or a chat message.
  • Making a compressed inline script readable while debugging.

Limitations and things to watch for

  • This is a token-based formatter, not a full parser like Prettier. It reliably restores indentation and statement breaks, but it does not rewrap long expressions, normalise quote style or make opinionated line-breaking decisions.
  • Minified code has already lost its original variable names; formatting restores structure, not meaning.
  • Automatic semicolon insertion is respected — no semicolons are added or removed, so behaviour cannot change.

Frequently asked questions

Can it fully restore minified code?
It restores indentation and line structure, which usually makes the logic followable. It cannot recover the original variable names, comments or file organisation, because the minifier discarded them.
Will it break my regular expressions or template literals?
No. The tokeniser distinguishes regular expressions from division, and template literals including nested expressions are preserved exactly as written.
Is this the same as Prettier?
No. Prettier reprints code from a full syntax tree and makes opinionated formatting decisions. This tool only adjusts whitespace between tokens, which is safer for unknown code but less thorough.

Share this tool