TypeScript Formatter: Re-indent and Break Lines (No Prettier)
Fixes indentation, blank lines and optionally line breaks in TypeScript code without sending it anywhere.
Use the tool
Why this tool exists
Messy indentation hides the structure of TypeScript code, and minified or copy-pasted code is worse. A re-indenter gives you the block layout back quickly.
The tool reads your code with a small scanner that knows strings, comments and raw literals, so braces inside them are ignored. It then sets the indent from bracket depth and, if you ask, puts a line break after braces and semicolons. It is not Prettier.
How to use it
- Paste your code.
- Pick the indent and whether to break lines at braces and semicolons.
- Copy the result.
- Run Prettier locally if you need exact style.
Frequently asked questions
Is this the same as Prettier?
No. Prettier also rewrites spacing, quotes and wraps lines to a print width. This tool re-indents and optionally breaks lines only.
Will it change what my code does?
It only changes whitespace outside strings, comments and raw literals. Test results: the non-whitespace text was unchanged on all test files, and re-running the tool gave the same output. Review the diff anyway.
Why not wrap long lines?
Wrapping needs a full parser. This tool does not have one.
Is my input sent anywhere?
No. Everything runs in your browser and nothing is uploaded.