Text UtilitiesText FormattersFree Tool
C++ Formatter
Apply basic bracket-based indentation to C++ code — not a real parser, so complex code (templates, macros) may not indent perfectly.
How to Use C++ Formatter
- 1Paste your C++ code
- 2Click Convert
- 3Copy the re-indented output — verify against clang-format for anything beyond simple code
Frequently Asked Questions
It counts opening ({, [, () and closing (}, ], )) brackets per line and adjusts indentation depth accordingly — a simple heuristic, not a real C++ parser.
No — angle-bracket template syntax isn't tracked as a bracket type, and preprocessor directives (#define, #ifdef) aren't specially handled.
clang-format is the standard — it uses a real parser and is highly configurable for different style guides.
No — the indentation pass runs entirely in your browser.
Related Tools
JSON Formatter
Pretty-print JSON with real 2-space indentation using the browser's native JSON parser — shows the exact parse error if your JSON is invalid.
JSON Minifier
Compress JSON to its smallest valid form by removing all whitespace, using the native JSON parser.
XML Formatter
Reformat XML with proper nested indentation based on tag depth — a lightweight tag-based indenter, not a full XML parser.
XML Minifier
Compress XML by stripping comments and collapsing whitespace between tags.