Skip to content

TypeScript Formatter

Format TypeScript with Prettier. Tidies types, interfaces, generics and decorators. Free online TypeScript beautifier in your browser.

Something not working? Report a problem

What is the TypeScript Formatter?

Paste TypeScript and get clean, consistent code. Types, interfaces, enums, generics and decorators are all handled.

Pick the indent size, line width, semicolons and quote style. If the code has a syntax error, you see the line and a short note.

How to use it

  1. Paste your TypeScript in the left box.
  2. The clean version shows on the right.
  3. Copy it or save it as a file.

Why people like this tool

Prettier powered

The same formatter many teams use.

Fast and private

Runs in your browser, nothing is sent.

Shows the error

Tells you where the code is broken.

Your style

Choose indent size and line width.

What it fixes

  • Types, interfaces and generics get neat indents, so long type lines are easy to scan.
  • Mixed tabs and spaces become one indent size.
  • Long lines are wrapped at the line width you set.

It uses the Prettier style, so the result matches what many TypeScript projects already use.

Good to know

This tool tidies the look of the code. It does not check your types or compile your code. A type error that the TypeScript compiler would find will still be there after formatting.

How it works, in one picture

Infographic: how to use the TypeScript Formatter in 3 easy steps: Add your text, Choose your options and Copy the result. You get: Prettier powered, Fast and private, Shows the error and Your style.

Frequently asked questions

How do I format TypeScript?
Paste your code in the left box. The formatted version shows on the right.
Does it check my types?
No. It only formats the code. Use the TypeScript compiler to check types.
Does it support TSX?
Basic TSX works. For big projects use Prettier in your editor.
Does this tool check my TypeScript types?
No. It only formats the code. Use the TypeScript compiler or your editor to find type errors.

You may also like