C# Formatter
Format and validate C# code online for free with clang-format, right in your browser.
Local browser processing
No sign-up required
Powered by clang-format
LanguageFor C# code
C#Program.cs
Style
Indent
Line width
InputEditable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
OutputC# valid32 lines · 555 B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq;
namespace MyApp {
public class Person {
public string Name { get; set; }
public int Age { get; set; }
public Person(string name, int age) {
Name = name;
Age = age;
}
public override string ToString() => $"{Name} (age {Age})";
}
class Program {
static void Main(string[] args) {
var people = new List<Person> {
new Person("Alice", 30),
new Person("Bob", 25),
new Person("Carol", 35)
};
var sorted = people.OrderBy(p => p.Age);
foreach (var p in sorted) {
Console.WriteLine(p);
}
}
}
}
UTF-8 · 4 spaces · Microsoft · clang-formatLocal processing · Ready
How It WorksC#
Overview
This C# formatter cleans up code with inconsistent indentation or mixed styles into a standard format, powered by a WebAssembly build of clang-format. It supports seven presets — Microsoft, Google, LLVM, Chromium, Mozilla, WebKit, and GNU. Everything runs locally in your browser; your code never leaves your device.
Use Cases
Format C# code pasted from docs or generated by AIUnify a team's C# code styleClean up legacy code with inconsistent indentationValidate whether code syntax is correct
Steps
123
Paste or uploadChoose a styleGet the result