Paste a snippet or a whole file: the formatter rebuilds the indentation with tabs and never edits tokens. Preprocessor directives and C++11 raw strings are copied byte for byte, so macros stay on one logical line.
Runs locally in your browserPaste C++ source and the formatter re-lays it out: one statement per line at each semicolon, braces on their own lines, one tab per nesting level and no blank lines. It is a plain-text rewriter that runs in the browser, so nothing you paste is uploaded.
The rewrite is whitespace only. Tokens, strings, comments and preprocessor directives are copied as written, which is what keeps the output compilable: a macro such as #define SWAP(a,b) do { … } while(0) stays on one logical line, and a C++11 raw string R"(…)" keeps its quotes and braces untouched.
Only the whitespace between tokens changes: line breaks are inserted after the semicolons that end a statement, braces open and close on their own line, and the indentation is rebuilt with tabs. Runs of blank lines are dropped. Long lines are not wrapped, and no token is renamed, reordered or removed.
Preprocessor lines are copied byte for byte up to the end of the logical line, including a trailing backslash continuation. A multi-line macro therefore survives: no line break is inserted inside #define, #if / #endif blocks keep their structure, and a directive that follows a closing brace stays at the start of its line.
Both comment styles are preserved: // to the end of the line and /* … */ across lines, including comment text that contains braces or quotes. Ordinary string and character literals are kept as written, so an escaped quote or a semicolon inside a string never moves the layout of the code around it.
C++11 raw strings — R"(…)", with or without a delimiter such as R"xx(… )xx" — are copied verbatim, so quotes, braces and semicolons inside them can never be mistaken for code. Template syntax such as std::vector<std::pair<int, std::string>> is left alone: the tabifier has no notion of angle brackets.
There is no C++ parser behind the page, so syntax is neither checked nor repaired: a missing parenthesis or an unterminated string comes back re-indented without any error message. The indentation width, brace placement and line length are fixed (one tab, braces on their own line, no wrapping); for project styles such as Google or LLVM run clang-format instead.
The result is highlighted with the C/C++ grammar of highlight.js; inputs above 120 KB are shown without highlighting so the page stays responsive. The tool never compiles or runs the code, and it keeps working offline once the page has loaded.