⚡
usefultools.dev
JS

JavaScript Formatter

NOUVEAU

Format and beautify JavaScript and JSON with Prettier: choose indent, quotes and semicolons, then copy the result.

Fonctionne à 100 % dans votre navigateur — vos données ne sont jamais envoyées ni stockées sur nos serveurs.

Cet outil n'est pas encore entièrement traduit : une partie du texte est encore en anglais. L'outil lui-même fonctionne de la même façon dans toutes les langues.

5 lines · 369 B

Paste code above and press Format (or just wait — it formats as you type).

⚡

Exemples rapides

Des entrées typiques et les résultats produits par cet outil.

Spacing
const a={b:1,c:[1,2]}
const a = { b: 1, c: [1, 2] };
Blocks
function add(a,b){return a+b}
function add(a, b) { return a + b; }
Quotes
let s='hi'
let s = "hi";
Arrow
const f=x=>x*2
const f = (x) => x * 2;
TypeScript
let n:number=1
let n: number = 1;
📖

Présentation

This JavaScript formatter beautifies minified, copy-pasted or inconsistent code using Prettier, the same engine many teams run in their editors and CI. Paste JavaScript, JSX, TypeScript, TSX, JSON, JSON with comments or JSON5 and get consistent indentation, line breaks and quotes in one click.

Developers use it to read code copied from DevTools or a bundle, clean up a snippet before a code review, or settle a style debate: pick 2, 4 or 8 spaces or tabs, a print width from 40 to 200, semicolons on or off, single or double quotes, trailing commas, arrow parentheses and more. Files can be uploaded or dropped in, and the download keeps the original extension.

Formatting runs entirely in your browser with Prettier loaded on demand, so your source code is never uploaded. If the code has a syntax error, the exact line and column are shown and that line is selected in the input.

Pourquoi utiliser cet outil ?

  • Prettier output, no editor setup needed
  • JavaScript, JSX, TypeScript, TSX and JSON
  • Exact line and column for syntax errors
  • Upload or drop a file, download the result
  • Private: your code never leaves the browser
⭐

Fonctionnalités

✨

Prettier engine

Uses Prettier 3 parsers (Babel, TypeScript, JSON, JSON5) so the output matches what most projects already use.

🔍

Language auto-detect

Picks JavaScript, JSX, TypeScript, TSX or JSON from the file extension or the code itself, or choose a parser manually.

⚙️

Prettier options

Indent, print width, semicolons, quotes, trailing commas, arrow parens, quote props, bracket spacing, line endings and object wrapping.

📍

Precise error location

Syntax errors show line, column and a code frame, and the offending line is selected in the input.

📂

Upload and download

Drop a .js, .jsx, .ts, .tsx or .json file and download the formatted version with the same extension.

📊

Size and line counts

See lines and size before and after, and send the output back to the input to format again with new options.

🛠️

Mode d'emploi

1

Add your code

Paste code into Code input, upload a file, drop one onto the box, or press Sample.

2

Choose the language

Leave Language / parser on Auto-detect or pick JavaScript, JSX, TypeScript, TSX, JSON or JSON5.

3

Set the style options

Pick indentation, print width, quotes, semicolons, trailing commas and the other options.

4

Copy or download

Press Format (or let it format as you type), then Copy, Download or Use as input.

🤔

Questions fréquentes