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.

clang-format presets

C formatting supports LLVM, Google, Chromium, Mozilla, WebKit, Microsoft, and custom .clang-format YAML styles.

Syntax expectations

clang-format formats C source text; it does not compile the code or validate headers and symbols.

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, click Prettify, and it's reformatted using clang-format (Google style) — the same engine used by real C/C++ codebases.

What formatting style does it use?+

Google style is the default, and you can switch to LLVM, Chromium, Mozilla, WebKit, Microsoft, or paste a custom .clang-format YAML config.

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.