Tabs vs. Spaces: The War Is Over

Jul 25, 2025 - 19:15
 0  0
Tabs vs. Spaces: The War Is Over

Tabs vs. Spaces: The War Is Over

The great indentation war is over and it seems like we have a clear winner.

Every now and then, while exploring a new programming language, I inevitably stumble upon a heated debate, often buried deep in a GitHub issue thread, where contributors are passionately arguing over whether the language’s formatter should default to tabs or spaces. Over the past few months, as I’ve been immersing myself in Zig, I encountered one such discussion.

It got me thinking: After decades of writing code, how is it that we still haven’t reached a consensus on the tabs vs. spaces debate? Sure, personal preferences will always vary, but shouldn’t we, at this point, be able to look at the broader data and settle the matter by majority rule?

So, I went looking for answers.

The state of indentation

To explore this question, I examined the default indentation conventions of the most popular programming languages and markup formats, along with a few niche ones. The list is based on official language style guides where available, or well-established third-party guides where not. The result is a relatively comprehensive snapshot of current best practices:

LanguageDefault indentationReferences
AdaSpaces (3)1
Ansible (follows YAML)Spaces (2)1
ApexSpaces (4)1
Assembly (x86, ARM)Tabs (8)1 2
BefungeSpatial1
BrainfuckNone1
C / C++Tabs or Spaces (2, 4, 8)1 2
C#Spaces (4)1
ClojureSpaces (2)1
COBOLSpaces (4)1
CowNone1
CrystalSpaces (2)1
CSSSpaces (2)1
DartSpaces (2)1 2
DelphiSpaces (2)1
ElixirSpaces (2)1
ErlangSpaces (4)1
F#Spaces (4)1
FortranSpaces (2 or 4)1
Gherkin (Cucumber)Spaces (2)1
GoTabs (4)1
GroovySpaces (4)1
HackSpaces (2)1
HareTabs (8)1
HaskellSpaces (2 or 4)1
HTMLSpaces (2)1
INTERCALNone1
JavaSpaces (2 or 4)1 2
JavaScriptSpaces (2)1
JSFuckNone1
JSONSpaces (2)1
JuliaSpaces (4)1
KotlinSpaces (4)1
LessSpaces (2)1
Lisp (Common Lisp)Spaces (2)1
LOLCODETabs1
LuaSpaces (2)1
MakefileTabs (8)1
MalbolgeNone1
MarkdownSpaces (2 or 4)1
MATLABSpaces (3 or 4)1
NimSpaces (2)1
Objective-CSpaces (2)1 2
OCamlSpaces (2)1
OdinTabs (4)1
PerlSpaces (4)1
PHPSpaces (4)1
PietNone1
PrologSpaces (2 or 4)1
PythonSpaces (4)1
RSpaces (2 or 4)1
ReScriptSpaces (2)1
RubySpaces (2)1
RustSpaces (4)1
ScalaSpaces (2 or 4)1
SchemeSpaces (2)1
SCSS/SassSpaces (2)1
ShakespeareSpaces1
Shell (Bash)Spaces (4)1
SoliditySpaces (4)1
SQLSpaces (2 or 4)1
SwiftSpaces (2 or 4)1 2
TerraformSpaces (2)1
TOMLSpaces (2)1
TypeScriptSpaces (4)1
VB.NETSpaces (4)1
VerilogSpaces (4)1
VHDLSpaces (2 or 4)1
WhitespaceSpaces1
XMLSpaces (2)1
YAMLSpaces (2)1
ZigSpaces (4)1 2

Roughly 90% of mainstream programming languages and markup formats adopt spaces as the preferred method of indentation. The use of tabs, by contrast, is relatively uncommon and typically reserved for a few notable exceptions. Languages such as Go, Odin, Hare, and Assembly explicitly recommend or rely on tabs, while C and C++ often leave indentation style to the discretion of individual projects or organizations, resulting in a mix of conventions.

Go, in fact, stands out as a rare example where the language’s core developers chose to enforce the use of tabs through tooling, rather than relying on a mere style guide. This decision effectively eliminates the possibility of using spaces for indentation altogether, for better or for worse.

Majority rule

However, the prevailing preference for spaces reflects a broader trend in standardization, much like the global shift toward the metric system or the dominance of right-hand traffic, regardless of any perceived advantages offered by the alternatives. And while there are specific domains, such as aviation or seafaring, where systems like the imperial unit still prevail over the metric, the world at large has gradually converged on a common standard. In much the same way, the majority of developers and style guides have come to favor spaces over tabs, suggesting that, for most practical purposes, the debate has largely been settled.

And so, it seems that, regardless of all the pros and cons, the Tabs vs. Spaces war is over, and that spaces have emerged victorious. But as with any cultural choice in technology, the question lingers:

Is it truly over? ;-)


Enjoyed this? Please consider supporting my work.

Published on 2025-07-24 and updated on 2025-07-24 in journal and tagged with command-line society text zig

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0