About JavaScript formatter
Clean up JavaScript and TypeScript with Prettier, the formatter most teams already use in their editors. Paste messy, minified or inconsistently styled code and get it back in one consistent style.
It understands modern syntax, JSX and TSX for React, and TypeScript types. Choose the options your project uses: semicolons or not, single or double quotes, tab width and maximum line length.
How to use it
- Paste your code or open a .js, .ts, .jsx or .tsx file.
- Pick JavaScript or TypeScript, then set quotes, semicolons and line width.
- Press Format. Syntax errors are reported with their line number.
- Copy the result or download it.
Same result as your editor
This page runs the real Prettier library (version 3), so the output matches what Prettier produces in VS Code or from the command line with the same options. It is handy when you are on a computer without your usual setup.
Questions
Can it un-minify code?
Yes, it will spread minified code over readable lines. It cannot bring back the original variable names if the minifier shortened them.
Does it change how my code behaves?
No. Prettier only changes layout: spacing, line breaks, quotes and optional semicolons.
Is my code private?
Everything happens inside your browser. Your file is never uploaded to a server, so it stays private and the tool keeps working even on a slow connection.