JavaScript Formatter

Format JavaScript, JSX, TypeScript and TSX without running the code.

Frontend & Design
Preparing your workspace…
Input
Output
Your result will appear here.

How to use

  1. Paste text, open a UTF-8 file, or try the Sample.
  2. Choose the input and settings, then run the tool or enable Auto run.
  3. Review the result, then copy or download it. Changing the input invalidates the previous result.

JavaScript Formatter

Format JavaScript, JSX, TypeScript and TSX without running the code.

Processing runs in your browser. Your input is not sent to DevToolsy.

How it works

Prettier parses and prints your source with consistent spacing and indentation. Select JavaScript / JSX or TypeScript / TSX to match the input; syntax errors include a source position.

Before and after
Input
const users=[{name:"Ada",active:true},{name:"Lin",active:false}];function activeNames(items){return items.filter(user=>user.active).map(user=>user.name)}
Output
const users = [
  { name: "Ada", active: true },
  { name: "Lin", active: false },
];
function activeNames(items) {
  return items.filter((user) => user.active).map((user) => user.name);
}

Format JavaScript, JSX, TypeScript and TSX without running the code.

Options and data fidelity

Set indentation, line width, quote preference and semicolons. This is a formatter, not a compiler, linter or minifier. It does not execute code or resolve imports.

Working with the result

Successful formatting means the parser accepted the syntax. Use your project compiler, linter and tests to check types, imports and runtime behavior.

Review the result, then copy or download it. Changing the input invalidates the previous result.

Processing limits

UTF-8 input up to 1 MiB per document, output up to 8 MiB. JSONPath and Schema: 5-second timeout; other tools: 30 seconds.

Further readingPrettier options
?

Frequently asked questions

Which JavaScript and TypeScript inputs work?

Prettier parses and prints your source with consistent spacing and indentation. Select JavaScript / JSX or TypeScript / TSX to match the input; syntax errors include a source position.

Can I choose quotes and semicolons?

Set indentation, line width, quote preference and semicolons. This is a formatter, not a compiler, linter or minifier. It does not execute code or resolve imports.

Does formatting check types or fix logic?

No. Successful formatting means the parser accepted the syntax. Use your project compiler, linter and tests to check types, imports and runtime behavior.

Is my input uploaded?

Processing runs in your browser. Your input is not sent to DevToolsy.

Can I open a local file?

UTF-8 input up to 1 MiB · output up to 8 MiB

Find your next tool

Language

Switch language? Your current work will be cleared. Copy or download it first.