Skip to content
Devtoolry

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

  1. Write or paste C#: top-level statements, or a classic class with static void Main.
  2. Put the lines your program reads with Console.ReadLine() in the stdin box.
  3. Click Run. The first run downloads the compiler and runtime (about 14 MB); later runs compile in well under a second.
  4. 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

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.