Ctrl / ⌘ + Enter to format

Formatting options

Example output is ready. Edit either panel or paste your code to begin.

Local processing · Up to 200,000 input characters

Tab indents · Esc, then Tab moves focus Ln 1, Col 1

Paste code here. Formatting never executes it.

Tab indents · Esc, then Tab moves focus Ln 1, Col 1
JavaScript

Output is editable. Copy and download use its current contents.

JavaScript formatting with a real parser

This tool uses Prettier’s Babel parser and ESTree printer to format JavaScript and JSX. It understands strings, comments, regular expressions, object literals, and modern syntax instead of inserting line breaks with text substitutions.

How to format JavaScript

  1. Paste a JavaScript program, module, function, or JSX component.
  2. Select indentation and preferred line width.
  3. Select Format JavaScript, then copy or download the formatted source.

Example

The sample filters a list of user objects and maps the active users to names. Formatting makes the object structure and chained operations easier to read while preserving their order. Prettier may add semicolons, normalize quotes, or expand expressions.

Limitations and safety

This is a formatter, not a linter, debugger, or TypeScript formatter. Syntax errors stop formatting; valid code can still contain runtime bugs. The worker parses text and never evaluates pasted code or imports packages named in it. Input is limited to 200,000 characters, with a Cancel button and a ten-second processing limit. Line width is a preference rather than a hard limit.