Image: HBO

It’s one of the greatest battles ever fought among coders: Should you use the tab button or five spaces when you’re indenting in source-code?

The debate ultimately boils down to how source-code is displayed in editing software. The reason people get angry is because the code doesn’t display nicely if the same method isn’t used throughout the file. This can get especially tricky when multiple people are working on the same project. The debate has gone on for so long that coders are now referred to as “tab people or “space people.” It was even referenced in a recent episode of Silicon Valley.

Google developer Felipe Hoffa decided he wanted to get to find a winner of this debate. So he parsed 1 billion files among 14 different programming languages to find out which method is actually more popular and then published the results in a recent blog post on Medium.

Images: medium / @hoffa

The data Hoffa used was sourced from GitHub files stored in BigQuery. He made sure there were no duplicates or files with less than 10 lines of code. The developer also gave one vote per file (so if it used both tabs and space, the vote went to whichever was used more frequently). Finally, the top 400,000 repositories were sorted by the number of stars they received on GitHub between January 2016 and May 2016.



Here’s what he found:

Images: medium / @hoffa

As you can tell from the data, the overwhelming winner here is spaces. In every major programming language besides C, spaces were used in the most popular files on GitHub. This evidence is about as definitive as it will ever get in revealing whether tabs or spaces are more popular in code.

But why? Space People will tell you that this is a no-brainer because spaces display the same across all hardware, text viewing software, and they’re flat out more visible than stupid tabs. Of course, Tab People might have a much different opinion about that.


Are spaces qualitatively better than tabs for some reason? It remains unclear. If you have a strong opinion either way, though, please fight it out in the comments.