Skip to main content
Z

C / C++ Formatter — Reindent C & C++ with Brace Controls

Reindent only — not a full formatter

Reindent C or C++ source — brace style, indent width, and preprocessor placement controls. Indentation tidy, not a full clang-format.

Free No signup Client-side Privacy friendly Updated

How to use

  1. 1 Pick C or C++.
  2. 2 Paste source.
  3. 3 Pick brace style, indent size, and where preprocessor lines should sit.
  4. 4 Copy or download the result.

Why use this tool

  • Astyle-equivalent rule set: braces, indent, preprocessor placement.
  • Preprocessor lines can stay at column 0 or follow nesting — your call.
  • Pure client-side — your code never leaves the browser.
  • For canonical output use clang-format locally with your .clang-format file.

Frequently asked questions

Does this match clang-format?

Approximate — we apply indent and brace style only. clang-format also handles pointer alignment, column-limit wrapping, and access-modifier indent. Use clang-format locally for canonical output.

C vs C++ — what changes?

The rule set is shared. The toggle controls which sample we load and which extension the download uses.

Will it preserve my macros?

Macro definitions on preprocessor lines are kept verbatim. Multi-line macros with trailing backslash are kept on consecutive lines but each is treated as one preprocessor line.

What is C / C++ Formatter?

A C / C++ Formatter is a tool that reindents C or C++ source code in the browser with controls for brace style, indent width, and preprocessor directive placement. It works as an indentation tidier rather than a full clang-format, applying consistent layout without compiling and keeping the source client-side.

Features

Brace-depth reindent

Re-indents functions and blocks by nesting, with K&R or Allman brace placement.

Preprocessor-aware

Leaves #include / #define directives at column zero instead of indenting them.

100% private

Runs on your device — your source is never uploaded.

Example

Input

#include <stdio.h>
int main() {
printf("hi");
return 0;
}

Output

#include <stdio.h>
int main() {
    printf("hi");
    return 0;
}

Common use cases

  1. 1

    Fix pasted C/C++

    Repair indentation on code copied from a textbook, PDF, or forum.

  2. 2

    Normalize brace style

    Convert a block between K&R and Allman placement.

  3. 3

    Quick tidy

    Clean up layout without a local clang-format setup.

Summary

Zerethon's C / C++ formatter reindents source in your browser by brace depth while keeping preprocessor directives (`#include`, `#define`) at column zero, with a K&R or Allman brace toggle. It is a lightweight reindenter, not a full clang-format — it tidies layout without reflowing code. Nothing is uploaded.

Category
Developer
Pricing
Free
Privacy
Browser-based
Signup
Not required

References

Privacy

Your data never leaves your browser unless explicitly stated. C / C++ Formatter runs entirely client-side — no server upload, no logging, no tracking of your input.

Related tools

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Sign up free