Menu

Online C++ Compiler

Write, run, and share code snippets — no setup required.

main.cpp
Output
Click Run to see the output here.

Compile and run C++ online in your browser

A free online C++ playground and compiler. Write C++ in your browser, hit Run, and g++ compiles and executes your program in seconds. No MSVC, no CMake, no Visual Studio to set up first.

The editor is built on the same engine as VS Code, so C++ syntax highlighting, header autocompletion, and diagnostic squiggles all work. Code compiles with g++ on Alpine Linux, with the full C++ STL available — <vector>, <map>, <unordered_map>, <algorithm>, <memory>, <thread>. Good for exploring smart pointers, testing a lambda, or prepping for a C++ interview.

What makes this C++ playground useful

  • Instant C++ compilation — write code, press Run, and see output from the online g++ compiler in seconds, no CMake or Visual Studio needed.
  • Full C++ syntax highlighting, header autocompletion, and clear g++ compile errors, powered by the same editor engine as VS Code.
  • Stdin input is supported. std::cin >> x, std::getline(std::cin, line), and scanf all read from the playground's input box, so competitive-programming patterns and interview problems work end-to-end. No g++, clang, MSVC, or CMake on your end.
  • g++ compiler with the full C++ STL — vector, map, unordered_map, algorithm, and modern C++ features without setting up a toolchain.

What you can build in the C++ playground

  • STL containers (vector, map, unordered_map, set) plus <algorithm> (sort, transform, accumulate). The classic interview toolkit.
  • Data structures by hand — linked lists, binary trees, hash maps — plus classic algorithms (BFS, DFS, dynamic programming) with modern C++17 syntax.
  • Quick C++ experiments: test a lambda, benchmark a sort, try auto type deduction, or confirm a pointer arithmetic trick without a CMake project.

Online C++ compiler FAQ

Is the online C++ compiler free?
Yes, the online C++ playground is free to use. No sign-up, no MSVC, no g++ to install, and no CMake to configure — open the page and compile.
Do I need g++ or a C++ compiler installed?
No install needed. You don't need g++, clang, or MSVC on your machine. The online C++ compiler compiles your code with g++ on Alpine Linux and runs it in seconds.
Does the C++ playground work on mobile and Chromebooks?
Yes. The C++ playground runs in any modern browser, on desktop, tablet or mobile. It's a good option for running C++ from a Chromebook or a machine where you can't install a compiler.
Does the C++ playground support std::cin and stdin?
Yes. std::cin >> n;, std::getline(std::cin, line);, and scanf all read your typed lines the same way they would when you run ./a.out locally. Good for competitive-programming problems, Codeforces-style inputs, and interview questions.
How do I learn C++ after trying the playground?
Edit the sample C++ code, press Run, and iterate. When you want something more structured, Coddy's interactive C++ course covers pointers, STL containers, templates, and modern C++ features.