Skip to main content

TypeScript Formatter

Auto-format TypeScript code with consistent indentation and spacing. Prettier-based formatting that handles type annotations and generics correctly.

Indent Settings

Code Input

Output

Share this tool
📖

How to Use

Step 1

Enter Code

Enter Code

Enter or paste the TypeScript code to format

Step 2

Set Format Options

Set Format Options

Set indent width, semicolons, and other options

Step 3

Get Formatted Code

Get Formatted Code

Copy or download the formatted code

Features

Prettier Compatible

High-quality auto-formatting based on Prettier

Custom Settings

Indent, quotes, semicolons and many other configurable options

Type Annotation Support

Correctly format TypeScript-specific type annotations and generics

FAQ

Yes, since TypeScript is a superset of JavaScript, JS code can be formatted as-is.