C/C++ Formatter

// Beautify and format C and C++ code

#About C/C++ Formatter

Free online C/C++ code formatter. Format C and C++ source code with configurable indentation, brace style, and preprocessor handling. This tool runs entirely in your browser — your data is never sent to a server. Just paste your input, get instant results, and copy with one click. No sign-up or installation required.

#FAQ

What brace styles are supported?
Choose between K&R style (same-line braces) or Allman style (new-line braces). Preprocessor directives are kept at column 0 regardless of indentation level.
Does it handle preprocessor directives?
Yes, #include, #define, #ifdef, and other preprocessor directives are recognized and kept unindented at the start of the line, following C/C++ conventions.
</> Embed this tool

Copy this code to embed the tool on your website. Adjust the height to fit your layout.

<iframe src="https://www.browserutils.dev/embed/cpp-formatter" width="100%" height="500" frameborder="0" title="C/C++ Formatter"></iframe>

#Related