JavaScript Formatter
Format JavaScript and JSX code with Prettier — choose indentation, line width, semicolons and quote style.
What is the JavaScript Formatter?
Consistent formatting removes style debates and makes code easier to review.
How does it work?
The code is parsed into a syntax tree with Babel and re-printed by Prettier. Syntax errors are reported instead of producing broken output.
Example
const f=(a,b)=>{return a+b} becomes neatly spaced, multi-line code.
Frequently asked questions
Is my data sent to a server?
No. This tool runs entirely in your browser; nothing you paste is uploaded or stored.
Does formatting change behaviour?
No. Prettier only changes formatting, never the meaning of the code.
Related tools
Enable JavaScript to use this calculator.