C# Formatter — Reindent C# Code with Allman Brace Style
Reindent only — not a full formatterReindent C# source with Allman braces, auto-property normalization, and expression-bodied member tidy-up. Indentation tidy, not a full Roslyn format.
How to use
- 1 Paste C# source code.
- 2 Pick brace style (Allman default for C#) and indent size.
- 3 Toggle auto-property normalization to tidy <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">{get;set;}</code> blocks.
- 4 Copy or download the result.
Why use this tool
- Defaults match the Microsoft / Visual Studio style: Allman braces, 4-space indent.
- Tidies common shorthand: auto-properties and expression-bodied members.
- Pure client-side — your code never leaves the browser.
- For full Roslyn-level format use <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">dotnet format</code> locally.
Frequently asked questions
Does this match the dotnet format CLI?
Close on braces and indent — but the CLI also reorders usings, applies analyzers, and rewrites expressions. Use dotnet format for canonical output.
Will it touch LINQ chains?
LINQ statements are reindented if they break across lines but never rewritten. Method-chain layout is preserved.
Looking for a Java formatter?
Yes — see our <a href="/java-formatter" class="underline">Java Formatter</a> which uses the same engine with K&R default.
What is C# Formatter?
A C# Formatter is a tool that reindents C# source code in the browser using Allman braces, with auto-property normalization and expression-bodied member tidy-up. It works as an indentation tidier rather than a full Roslyn-based formatter, applying consistent layout to code while keeping the source on the user's device.
Features
Allman-style reindent
Re-indents by nesting and places braces on their own line, the .NET convention (K&R also available).
Accessor & => tidy
Normalizes `{ get; set; }` spacing and expression-bodied member arrows.
100% private
Runs client-side — your C# is never uploaded.
Example
Input
public class A {
int X{get;set;}
}
Output
public class A
{
int X{ get; set; }
}
Common use cases
-
1
Fix pasted C#
Repair indentation on a snippet from a log, gist, or forum.
-
2
Apply Allman style
Normalize brace placement to the standard .NET convention.
-
3
Tidy before commit
Clean up layout without running a full dotnet-format pass.
Zerethon's C# formatter reindents C# source in your browser by brace depth, defaulting to the Allman brace style common in .NET, and normalizes auto-property accessors (`{ get; set; }`) and expression-bodied `=>` spacing. It is a lightweight reindenter, not a full dotnet-format — it tidies layout without a full rewrite. Nothing is uploaded.
- Category
- Developer
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
References
- C# Coding Conventions — Microsoft Learn
- C# language specification — Microsoft Learn
Privacy
Your data never leaves your browser unless explicitly stated. C# Formatter runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
JSON Formatter
Format, validate, and minify JSON online. Free, no signup — your data never leaves your browser.
Open toolSQL Formatter
Format SQL queries online — beautify MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery.
Open toolUUID Generator
Generate UUIDs online — v1, v4, v7, and Nil. Bulk generation up to 10,000. Free, no signup.
Open toolPassword Generator
Generate strong, cryptographically random passwords. Configurable length and character sets — runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.