Tabs or spaces? Spaces, obviously, but how many?

Tabs or spaces? Spaces, obviously, but how many?

If you're passionate about code indentation, you're not alone.

A bunch of question marks
Image by :

Subscribe now

Get the highlights in your inbox every week.

One level of code indentation should be

Depending on who you ask, it's either the silliest or the most important question when it comes to coding style: tabs or spaces?

When we asked you, our readers, the question last summer, spaces came out on top. That said, it's a nuanced question where things like programming language, editor, and project style all should play a role.

Regardless of where you come down on the spaces versus tabs debate, there's a related question: If you use spaces, how many do you use, and if you use tabs, what number of spaces do you set to be equivalent to the depth of one tab level?

There's an argument for using as few as possible, particularly when the code you're writing includes particularly verbose naming conventions that drag the total number of characters per line quickly towards the triple-digits. Or perhaps you've got particularly deep levels of indentation in your code, and for whatever reasons aren't breaking longer code blocks up into subroutines.

The argument for using more spaces is also readability, but on the other side: It's sometimes hard to easily tell the indentation depth of a line of code if you don't use enough spacing, particularly with smaller font sizes.

So we ask you, dear reader, how many spaces equal one level of indentation in your editor of choice?

About the author - publishes stories about creating, adopting, and sharing open source solutions. Follow us on Twitter @opensourceway.