clang-format style

Active style: Google

Input

Output

Formatted output will appear here.

C++ Formatter

Paste or import C++ above and click Prettify to reformat it with consistent indentation and spacing — free, in your browser, with nothing uploaded to a server. Powered by clang-format.

Modern C++

clang-format handles templates, lambdas, namespaces, references, pointers, and modern declaration styles.

Style presets

Switch presets or paste custom .clang-format YAML to match a project style before copying or downloading output.

Other formatters

Need to convert Markdown instead? Try the free Markdown to Word/HTML/PDF converter.

Need to run some numbers? Try the free online calculators.

Frequently asked questions

How do I format C++ code online?+

Paste your C++ code, choose a clang-format preset or custom .clang-format YAML if needed, then click Prettify.

Does it support modern C++ (templates, lambdas, etc.)?+

Yes — clang-format handles modern C++ syntax including templates, lambdas, and structured bindings.

Is my code sent to a server?+

No. clang-format runs in your browser via WebAssembly — nothing is uploaded.

More formatters

JSON formatter · JavaScript formatter · TypeScript formatter · CSS formatter · YAML formatter · C formatter · VBScript formatter

We use cookies to show ads via Google AdSense. See our Privacy Policy for details.