C and C++ Code Formatter: Re-indent Blocks (No clang-format)

Fixes indentation, blank lines and optionally line breaks in C and C++ code without sending it anywhere.

Use the tool

Why this tool exists

Messy indentation hides the structure of C and C++ code, and minified or copy-pasted code is worse. A re-indenter gives you the block layout back quickly.

The tool reads your code with a small scanner that knows strings, comments and raw literals, so braces inside them are ignored. It then sets the indent from bracket depth and, if you ask, puts a line break after braces and semicolons. It is not clang-format.

How to use it

  1. Paste C or C++ code.
  2. Pick the indent and line break mode.
  3. Copy the result.
  4. Use clang-format locally for a named style.

Frequently asked questions

Is this the same as clang-format?

No. clang-format applies full style presets, wraps lines and aligns declarations. This tool re-indents and optionally breaks lines only, with no LLVM or Google preset.

Will it change what my code does?

It only changes whitespace outside strings, comments and raw literals. Test results: the non-whitespace text was unchanged on all test files, and re-running the tool gave the same output. Review the diff anyway.

Why not wrap long lines?

Wrapping needs a full parser. This tool does not have one.

Is my input sent anywhere?

No. Everything runs in your browser and nothing is uploaded.