Skip to content

Playground

C++ playground

This runs a genuine clang toolchain compiled to WebAssembly, so the errors are clang's own, try/catch really works, and std::cin really reads from the input box. How the sandbox works, and its honest limits, is on the code execution and security page.

clang via Emscripten 3.1.24 (2026-09-12 build)

Before you start: this one is heavy, and slow to wake up

A C++ compiler is a large program, and this is a real one. The honest numbers:

  • Nothing downloads until you press the button. The first time you start it, about 27 MB downloads, and your browser keeps a copy, so later visits download nothing.
  • Even with that copy, the compiler has to be unpacked again on every page load. On our test machine the first result arrived about 15 to 18 seconds after pressing the button, including the first compile. Over a real internet connection the very first visit takes longer.
  • After that, each run took about 2 to 6 seconds.
  • The toolchain is from late 2022. The C++20 core language works, but the std::ranges algorithms are newer than this library and are not there.

For comparison, measured the same way: JavaScript starts instantly, TypeScript in about 2 seconds, Java in about 2.5 and Python in about 6. C++ is the expensive one, and it is expensive because it is real rather than simulated.

Ctrl/Cmd+Enter to run

Press Esc then Tab to move keyboard focus out of the code editor.

Ready
Output will appear here after you run your code.

Not sure what to type?

A blank editor is the hard place to start. The C++ exercises hand you a program that already runs and ask you to change one thing.