EMBEDDED TOOL
Arduino Sketch Formatter
Reformat a .ino sketch with clean, brace-based indentation.
About this tool
Paste a messy or inconsistently indented Arduino sketch to reformat it with clean, brace-based indentation — pick 2 spaces, 4 spaces, or tabs. Comments (// and /* */) and string/char literals are tracked so braces inside them don't throw off the indentation.
Frequently asked questions
- Does this validate my code or check that it compiles?
- No — it only re-indents based on brace nesting depth. It doesn't parse C++ syntax, check types, or verify the sketch would actually compile in the Arduino IDE.
- What happens with mismatched braces?
- Since indentation is driven purely by counting
{and}, a missing or extra brace will throw off the indentation of everything after it — the same way it would confuse any editor's auto-indent. Fix brace mismatches in your source first for best results. - Will this reformat multi-line block comments?
- Lines inside a
/* ... */block comment are left exactly as written (not re-indented), so ASCII art or manually aligned comment text won't get mangled.