Code Style

Tabs vs Spaces

The classic indentation debate. Tabs are a single character that each developer can render at any width; spaces produce identical alignment everywhere.

Side-by-side comparison

TabsSpaces
File sizeSmaller (1 char)Larger (n chars)
Customizable widthYes (per developer)No (fixed)
AccessibilityBetter (adjustable)Fixed width
ConsistencyCan vary by editorIdentical everywhere
Common inGo (gofmt), MakePython (PEP 8), JS/Prettier

When to use Tabs

  • You value adjustable indentation width
  • Accessibility (e.g. larger indents)
  • Languages/tools that mandate tabs (Go)

When to use Spaces

  • You want pixel-identical alignment everywhere
  • Following PEP 8 / Prettier defaults
  • Mixed-content alignment

Bottom line

There is no universal winner — what matters is consistency within a project. Let an autoformatter (Prettier, gofmt, Black) decide and enforce it so the debate never recurs.

More comparisons