What Can You Do with Compiler Explorer?

Updated

Compiler Explorer is an interactive online compiler that shows the assembly output of compiled C++, Rust, Go, and many other languages. You can use it to see exactly what a compiler does with your code: write source in the editor, pick a compiler and version, set flags, and read the generated assembly side by side with your input. Beyond that basic loop, it offers execution, binary output, optimization remarks, AST and IR views, and diff-style comparison of two compilations.

See the assembly your code compiles to

The core workflow is: type or paste code into the source editor, choose a language and compiler from the compiler selector, and the output pane updates with the generated assembly. The output pane has its own options, including Intel asm syntax, demangling of identifiers, verbose demangling, and filters for unused labels, library functions, directives, comments, and horizontal whitespace. You can wrap lines and select all output.

This is useful when you want to confirm whether a construct compiles to a single instruction, whether a loop was vectorized, or how a template or generic instantiation was resolved.

Switch compilers, versions, and flags

You can change the compiler and its version without leaving the page, and add compiler flags through the compiler options. A "Popular arguments" list and a "Detailed Compiler Flags" window are available for editing verbose flags. You can also add libraries and overrides, and clone a compiler or executor configuration.

Because the compiler version is selectable, you can check whether behavior changed between releases — for example, whether a newer version emits a tighter instruction sequence for the same source.

Execute the code and inspect binaries

The compiler output options include compiling to a binary object, linking to a binary, and executing the code. Execution has its own settings: compilation arguments, stdin, and runtime tools. This lets you test small programs end to end rather than only reading assembly.

Use the analysis and intermediate-representation views

The "Add tool" menu exposes many views beyond assembly, including:

View What it shows
Preprocessor Source after preprocessing
AST Abstract syntax tree
LLVM IR LLVM intermediate representation
ClangIR ClangIR output
Opt Pipeline Optimization pass pipeline
Control Flow Graph Graph of basic blocks
GCC Tree/RTL, GIMPLE GCC intermediate forms
Rust MIR, Rust HIR, Rust Macro Expansion Rust-specific stages
GHC Core, GHC STG, GHC Cmm Haskell compilation stages
Lean C Output, Yul (Solidity IR) Language-specific output
Clojure Macro Expansion Macro expansion for Clojure

Several of these have their own filters and options — for example, the LLVM IR view can demangle symbols, hide debug info and instruction metadata, and filter attribute groups, comments, declarations, and library functions. The optimization pipeline view can show missed, passed, and analysis optimization remarks, and can hide inconsequential passes.

Compare two compilations

A Diff View and a Tree (IDE Mode) layout are available, and the output area supports a left/right split with its own filters. Combined with the ability to open a new tab and keep history, this makes it practical to put two compilers, two versions, or two flag sets next to each other and read the differences directly.

Share and embed your setup

You can generate a short link or full link to your current code and configuration, embed the view in an iframe, and save or load state. Templates and a version tree are also provided. Note that the regular site requires JavaScript; a noscript version is linked for when JavaScript is unavailable.

Practical notes

  • The interface includes a "Reset UI layout" and "Reset code and UI layout" option if you rearrange panes and want to start over.
  • A "Conformance View" and "Compiler Execution Only" mode exist for narrower tasks.
  • The site lists sponsors, a shop, a mailing list, a wiki, and a changelog, and states that the source is on GitHub — useful if you want to check how a feature works or report an issue.

If your goal is to understand what a specific compiler does with a specific piece of code, the shortest path is: paste the code, select the compiler and version, add the flags you care about, then read the assembly or open the IR/AST view that matches your question.