Razor Formatter tidies .razor and .cshtml files, re-indenting the mix of HTML, C# and Blazor components and putting the directives in order. Paste your code above, press Format, and copy the result.
Your code never leaves your machine. Formatting runs in your browser, inside a Web Worker on your own device, so nothing you paste is uploaded or logged. There are no accounts and no tracking of what you format. Once the page has loaded it keeps working offline, so you can bookmark it and come back any time.
@code blocks and Razor control flowSystem namespaces first@() expressions and normalises blank linesThe engine formats around 15,000 lines in under 100 milliseconds, and runs off the main thread so the interface stays responsive while it works. Lines you cannot see yet are left unrendered until you scroll to them, which keeps even large files smooth. Your preferences and your last snippet are kept in the browser between visits.
If a file does not format the way you expect, or there is a feature you would like added, get in touch. A short note with a small example is the quickest thing to act on, and every message is read.
Email me. Razor Formatter is made by Tahleel Consultancy.
Razor Formatter v5.0 · Free to use