About this C playground
This is a C compiler you can use straight away. Write C in the editor, press Run, and your program is compiled with GCC and run. The output appears next to it: everything it prints, any compiler error or warning with its line number, the exit code, and how long it took.
Your code is compiled and run in an isolated sandbox on our servers, with a real GCC on Linux, so it behaves the way it will on your own machine. It is free, with nothing to install and no account needed.
What you can run
- GCC 11.4, C17, running one file per run, saved as
main.c. - Compiled, then run. Each run compiles your file with
gcc -std=c17 -O2 -Wall -o main main.c -lmand runs the program if it compiles. Compiler errors and warnings appear in the output like any other error. - Standard library only. The whole C standard library is there: stdio.h, stdlib.h, string.h, math.h (already linked), ctype.h, time.h and the rest, plus POSIX headers such as unistd.h. There is no package installer, and programs have no network access.
- Limits: 10 seconds and 256 MB of memory per run, plus up to 20 seconds to compile first. Output past 64 KB is cut off, code can be up to 64 KB and input up to 16 KB.
- Fair use: 5 runs a minute and 50 a day without an account, 10 a minute when you are signed in.
Reading input
Open the Input box under the editor and type what your program should read. scanf, getchar and fgets read it as standard input, a line at a time. With the box empty they find nothing: scanf returns EOF and fgets returns NULL.
int age;
if (scanf("%d", &age) == 1) printf("%d\n", age);Frequently asked questions
Is this online C compiler free?
Yes. There is no sign-up and no limit on how much you can write. Signed-out visitors get a quick, usually invisible bot check when they press Run, and a fair-use cap of 5 runs a minute and 50 a day. Signing in raises it to 10 runs a minute.
Which compiler and C standard does it use?
GCC 11.4 on Ubuntu Linux, compiling as C17 with gcc -std=c17 -O2 -Wall and the maths library linked. So C17 and everything before it works, with optimisation on and the common warnings turned on.
Why does my code show warnings but still run?
Warnings, from -Wall, point at code that compiles but is probably a mistake, such as an unused variable or a printf format that does not match its argument. The program still runs. An error stops the compile, and then nothing runs: fix the line it names and press Run again.
Can I use more than one file or my own headers?
No. Each run compiles one file, main.c, against the standard library. Put everything in that file: structs, helper functions and main.
Why did my program stop with a time-out?
Compiling gets up to 20 seconds of its own. Then the program gets 10 seconds and 256 MB of memory, and is stopped if it goes past either. The usual cause is a loop that never ends, or a scanf waiting in a loop for input that is not in the Input box.
Is my code saved or shared?
Your code is kept in your own browser so it is still there next time, and nowhere else. When you press Run it is sent to our code runner, run once in a sandbox, and thrown away. We do not store it or show it to anyone.