Online C# Compiler
Run C# code online with Roslyn and .NET 10: C# 14, top-level statements, LINQ, records and Console.ReadLine input, in your browser, so code stays private.
Runs in your browser · Nothing uploaded · No sign-up
Something not working, or missing a feature? Send feedback
About the C# Compiler
The online C# Compiler compiles your code with Roslyn, the official C# compiler, and runs it on .NET 10, so you can try C# 14 features, test a LINQ query or practise an interview question without installing Visual Studio or the .NET SDK. Both the compiler and the runtime run in your browser as WebAssembly, so your code is never uploaded.
Your code runs in an isolated Web Worker in your browser, so it never leaves your device.
How to use the C# Compiler
- Write or paste C#: top-level statements, or a classic class with static void Main.
- Put the lines your program reads with Console.ReadLine() in the stdin box.
- Click Run. The first run downloads the compiler and runtime (about 14 MB); later runs compile in well under a second.
- Fix compiler errors, shown as Program.cs(line,column): error CS…, then read the output and exit code.
Common mistakes
- Stack traces without line numbers. An unhandled exception shows its type, message and the methods it passed through, but not line numbers. Add Console.WriteLine calls around the code you suspect.
- Deep recursion. A stack overflow ends the .NET runtime, as it does on your computer. The compiler reports it and starts a fresh runtime on the next run.
- Nullable warnings. Nullable reference types are on, as in new projects, so int.Parse(Console.ReadLine()) warns that the line may be null. Use Console.ReadLine()! or a null check.
Works well with the C# Compiler
- JSON to C#: generate C# classes from JSON.
- C++ Compiler: compare the same algorithm in C++.
- Regex Tester: test a pattern before using it with Regex.
Frequently asked questions
Which C# and .NET versions are used?
C# 14 with Roslyn 5.9 on .NET 10, the current long-term support release. Records, pattern matching, collection expressions, primary constructors and the field keyword all work.
Do I need a class and a Main method?
No. Top-level statements work like in a new dotnet console project, and the usual namespaces (System, System.Linq, System.Collections.Generic, System.IO and System.Threading.Tasks) are imported for you. A classic class with static void Main or static async Task<int> Main works too.
How do I read input?
Type it in the stdin box. Console.ReadLine() returns one line at a time and null when the input is used up; Console.In.ReadToEnd() returns everything at once.
Does async/await work?
Yes: await Task.Delay, Task.Run and Task.WhenAll work, and so does Parallel.For. Everything runs on one thread in the browser, so new Thread() is not supported and parallel code does not run faster.
Can I use NuGet packages, files or the network?
The whole .NET base class library is available (LINQ, System.Text.Json, Regex, BigInteger, collections), but NuGet packages cannot be added. File reads and writes go to a temporary in-memory file system, and HttpClient has no network access.
Related tools
JavaScript Compiler
Run JavaScript online in an isolated browser sandbox. See console output, errors and execution time instantly, with top-level await and stdin input.
TypeScript Compiler
Compile and run TypeScript online. Your code is type-checked with the official compiler in strict mode, then runs in a sandboxed worker in your browser.
Python Compiler
Run Python 3 code online with the full standard library and stdin input. It runs in your browser with Pyodide (WebAssembly), so your code stays on your device.
PHP Compiler
Run PHP 8.4 code online and see the output instantly, with stdin input and mbstring. PHP runs in your browser with WebAssembly, so your code stays private.
C Compiler
Compile and run C code online with Clang 21, a GCC-compatible compiler: pick C89 (ANSI C), C99, C11, C17 or C23 and add stdin input. Your code stays private.
C++ Compiler
Run C++ code online for free: compile C++20 with Clang 21 and libc++, type stdin input and see the output. It runs in your browser, so your code stays private.