HTML Minifier
Online HTML Minifier reduces the size of HTML files by minifying HTML code and improve website performance.
Reformat messy or minified TypeScript into clean, consistent, Prettier-style code — free, fast, and entirely in your browser.
The TypeScript Formatter is a free online tool that reformats messy, minified, or inconsistent TypeScript into clean, readable code. Paste your source and it instantly re-emits it following Prettier's canonical style.
It is powered by Prettier, self-hosted and running entirely in your browser. Your code is never uploaded, stored, or seen by any server.
Because everything runs locally, the tool is safe for private, proprietary, or client code. Nothing leaves your machine.
A TypeScript formatter is a tool that rewrites your .ts code into a single, consistent style without changing what the program does.
It normalizes the cosmetic details you should not have to think about: indentation, spacing, quote characters, semicolons, trailing commas, and line width.
Crucially, it preserves your type annotations, interfaces, generics, and decorators exactly as written. Only the layout changes.
So let x:number=1 becomes let x: number = 1; — the type stays, the formatting is fixed.
If the input is not syntactically valid TypeScript, the tool reports a clear error with the location of the problem instead of producing broken output.
Consistent formatting removes an entire category of pointless debate from code review. Nobody has to argue about tabs, quotes, or where a brace goes.
It also keeps version-control diffs small and meaningful. When every file follows the same rules, a diff shows real logic changes rather than reshuffled whitespace.
For TypeScript specifically, clean layout makes complex type signatures far easier to read. A well-wrapped generic or union type is much clearer than one crammed onto a single long line.
Prettier understands the full TypeScript syntax, so the formatter treats your types as first-class code, not plain text.
It normalizes spacing around type annotations like const id: string and inside interface and type declarations.
It formats generics such as Map<string, User>, wraps long union types like A | B | C cleanly, and lays out decorators on their own lines above the class or member they annotate.
It tidies arrow functions, standardizes import statements, and applies consistent quotes and semicolons throughout — all while leaving the underlying types untouched.
A formatter and a linter solve different problems, and they work best together.
Prettier formats. It rewrites how your code looks — indentation, wrapping, quotes, and spacing — and does not care about logic or potential bugs.
ESLint lints. It analyzes your code for problems: unused variables, unsafe patterns, missing return types, and other rule violations. It can warn you, but it is not primarily a style engine.
The two are complementary. Use Prettier to make code look consistent, and a linter like ESLint to catch mistakes. This tool covers the formatting half.
Reach for the formatter whenever you inherit unfamiliar code, paste a snippet from documentation, or need to clean up something that was minified or hand-mangled.
It is also handy for quickly standardizing a file before committing, or for making a dense type definition readable while you study it.
If you work across languages, you may also want the JS & CSS Beautifier for plain JavaScript and stylesheets, or the JSON to TypeScript tool when you need to generate interfaces from raw JSON.
When you are ready to ship, the JavaScript Minifier compresses compiled output for production, and the Remove Comments tool strips annotations and notes from code you want to hand off cleanly.
No. The formatter runs entirely in your browser using a self-hosted copy of Prettier. Your TypeScript is never uploaded, stored, or seen by any server, which makes it safe for private and proprietary code.
The tool is powered by Prettier, the industry-standard opinionated code formatter. It applies Prettier's canonical style so your output matches what teams using Prettier expect.
No. Formatting only changes how the code looks — indentation, spacing, quotes, semicolons, and line wrapping. Your logic, types, and runtime behavior stay exactly the same.
Yes. Prettier fully parses TypeScript, so type annotations, interfaces, generics, union types, and decorators are all preserved and formatted correctly rather than treated as plain text.
That is your choice. The tool supports 2-space, 4-space, and tab indentation. Two spaces is the most common convention in the TypeScript community, but any option produces consistent output — just pick one and apply it everywhere.
No. This is a formatter, which controls how code looks. A linter such as ESLint analyzes code for bugs and rule violations. They are complementary tools, and this one handles the formatting side.