Online C Compiler

main.c
// Online C compiler
// Write your code here and press Run.

#include <stdio.h>

int main(void) {
    printf("Hello, World!\n");

    for (int i = 1; i <= 3; i++) {
        printf("The square of %d is %d\n", i, i * i);
    }

    // Tip: to give your program keyboard input,
    // type the values in the Input box below the output.
    return 0;
}
Output

Output will appear here. Press Run or Ctrl + Enter.

Ready

About this C compiler

This free online C compiler lets you write, compile and run C programs without installing anything. Type your code, press Run, and the program's output appears next to the editor.

The code is compiled to WebAssembly by a C compiler running inside your browser, so there is no account to create and your program is not sent to a server. It is handy for homework, for practising pointers and loops, or for checking how a library function behaves.

How to use it

  1. Write or paste your C program in the editor. It needs a main function.
  2. If your program reads input with scanf, fgets or getchar, type the values in the Input box below the output, one per line, in the order the program asks for them.
  3. Press Run (or Ctrl + Enter). The first run downloads the compiler (about 19 MB, saved by your browser afterwards), so it takes longer than later runs.
  4. Compiler errors and warnings show the file line number so you can fix them, and your program's output follows.

Features

  • Compiles C (GNU C11) with clang, entirely in your browser
  • Standard library including stdio, stdlib, string and math
  • Input through the Input box, read with scanf, fgets or getchar
  • Clear compiler errors and warnings with line numbers
  • No login, no install, works on any modern device
  • Dark and light themes, automatic saving, download as .c

Good to know

Frequently asked questions

Does this C compiler need an internet connection?

You need a connection the first time to download the compiler. After that your browser keeps it, and compiling and running happen on your own device.

How do I give my C program input?

Type the values into the Input box below the output, one per line, then press Run. scanf, fgets and getchar read from it.

Which version of C is used?

GNU C11, compiled with clang. Standard C99 and C11 code works as expected.

Why is the first run slow?

The compiler itself is downloaded and prepared on the first run. Later runs on the same device are much faster because the files are already cached.

Is it free?

Yes. There is no sign-up, and nothing is executed on our servers.

Other online compilers