JavaScript formatter
Paste messy or minified JavaScript, JSX or TypeScript to get properly indented, readable code; choose quotes, semicolons, trailing commas and line width.
How to format JavaScript
- Paste code on the left or open a .js, .jsx, .ts or .tsx file.
- Pick JavaScript or TypeScript, then the indent, line width, quotes, semicolons and trailing commas your project uses.
- Copy or download the formatted file.
Frequently asked questions
Yes. Pick JavaScript / JSX for plain React code and TypeScript / TSX for code with type annotations.
Yes, it runs Prettier itself, so the result matches running Prettier in your project with the same options.
Yes, the code is broken into lines and indented again. Variable names that were shortened (a, b, c) stay that way.
Something in the code is mistyped, such as a missing closing bracket or an extra comma. The message gives the line, column and kind of problem.
It is completely free and needs no sign-up.
Related tools
HTML formatterBeautify HTML code with clean indentationCSS formatterBeautify CSS, SCSS and Less codeJSON FormatterFormat, minify and validate JSONSQL formatterMake SQL queries easy to readURL parserSplit a link into parts and edit its queryUser-Agent parserFind browser, OS and device from a user agentCIDR CalculatorNetwork details of an IPv4 or IPv6 CIDR blockSubnet CalculatorSplit an IPv4 network into subnets, VLSM tooMIME Type LookupLook up MIME types and check a file's real type