JavaScript Formatter
NOUVEAUFormat 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.
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.
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
Add your code
Paste code into Code input, upload a file, drop one onto the box, or press Sample.
Choose the language
Leave Language / parser on Auto-detect or pick JavaScript, JSX, TypeScript, TSX, JSON or JSON5.
Set the style options
Pick indentation, print width, quotes, semicolons, trailing commas and the other options.
Copy or download
Press Format (or let it format as you type), then Copy, Download or Use as input.