Online C compiler

This compiles and runs your C with a real compiler and linker. Your code never leaves this tab.

main.cC17 compiler

Press Run. The first run downloads the engine once, then your browser keeps it.

C · runs in your browser · nothing uploadedLn 1, Col 1

// Free tool

This compiles and runs your C with a real compiler and linker - inside the tab, at -O2, with the undefined-behavior sanitizer on. Index past the end of an array or overflow a signed int and the program stops on that line and tells you, instead of printing garbage and carrying on.

Nothing you type is sent to a server. Your code is saved only in this browser, the engine is downloaded once and cached, and once it has loaded the page keeps running your code with the network off. No account, no sign-in, no limit on how many times you press Run.

// What you get

C17 compiler, in a browser tab

A real C17 compiler and linker, running in your tab, with the undefined-behavior sanitizer on. Read past the end of an array or overflow a signed int and the program stops on that line and says so.

What it supports

  • C17 at -O2: structs, pointers, malloc and free, qsort and the string functions.
  • The undefined-behavior sanitizer: an index past the end of a declared array, signed overflow, a NULL dereference, a bad shift or a division by zero stops the program and names the line.
  • Standard input through scanf, fgets and getchar, from the Input box.

What it does not

  • The sanitizer does not see everything: an index past the end of memory from malloc, or of an array passed in as a pointer, is not caught, and neither is an overlapping memcpy.
  • No network, no filesystem and no threads. time() reads a fixed date and rand() starts from the same seed, so a program prints the same thing every run.
  • A program is stopped after 10 seconds.

// Why it runs here

Your code never leaves the tab

Most online compilers send your code to a server, run it in a container, and send the output back. That means a queue when the site is busy, a hard cap on how long your program may run, and a copy of your code on someone else's disk. This one downloads the compiler instead, once, and runs everything locally from then on.

No upload, no account

  • The compiler is fetched once and cached; your source is never sent anywhere.
  • Nothing is stored on our side. Your code is kept in this browser only, so it is still here when you come back.
  • Once the engine has loaded, it keeps running with the network off, which a hosted sandbox cannot do.

Then practice it for real

  • A runner tells you what your code printed. It cannot tell you whether you have learned anything.
  • Prepshotz runs the same engines against real test cases and grades the result.
  • Practice C with graded problems →

// Questions

C in the browser - FAQ

01What does the sanitizer catch?

An index past the end of a declared array, signed integer overflow, a NULL pointer dereference, a misaligned access, a shift by too much and a division by zero. Each one stops the program and prints where it happened - main.c:9: array index out of bounds - instead of letting it carry on with whatever was in memory. It is the same check the graded C practice on Prepshotz runs under.

02Can it read input?

Yes. Whatever you type in the Input box arrives on standard input, so scanf, fgets and getchar read it, and they reach the end of input when it runs out, as they would reading from a pipe.

03Which standard and which flags?

C17, compiled at -O2 with -fsanitize=undefined and then linked. Warnings do not stop a build; errors are the compiler's own, with the line and column.

04Does my code get uploaded anywhere?

No. The compiler runs inside your browser tab, so your code never leaves your machine. There is no server to send it to and nothing is logged on our side. Your code is kept only in this browser, and a share link carries it inside the link itself.

05Is it really free, and do I need an account?

Yes, and no. Every tool here runs without an account, a card, or a sign-in. They are free because they cost us nothing per run: the compiler is downloaded to your browser once and your own machine does the work.

Run C here. Get graded on it there.

Free while we're in beta.