TypeScript Formatter
Format TypeScript and TSX code with Prettier, including types, generics and decorators.
About the TypeScript Formatter
The TypeScript Formatter formats .ts and .tsx code with Prettier, including type annotations, generics, enums and decorators.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the TypeScript Formatter
- Paste TypeScript or TSX, or open a file.
- Choose indentation, quotes and semicolons.
- Copy or download the formatted code.
Frequently asked questions
Does formatting type-check my code?
No. Formatting only needs valid syntax. Use the TypeScript Compiler tool to see type errors.
Is TSX supported?
Yes, JSX inside TypeScript files is formatted too.
Related tools
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.
HTML Formatter
Beautify messy or minified HTML into clean, indented markup using Prettier, right in your browser.
CSS Formatter
Format CSS, SCSS and Less stylesheets into readable, consistently indented code.
JavaScript Formatter
Beautify JavaScript and JSX with Prettier. Choose indentation, quotes and semicolons.
PHP Formatter
Beautify PHP code following PSR-style formatting with the Prettier PHP plugin.
SQL Formatter
Format SQL queries for MySQL, PostgreSQL, SQLite, SQL Server and more with keyword casing options.