What are hard and soft tabs?

Keavon picture Keavon · Oct 14, 2014 · Viewed 21.2k times · Source

I hear the term "hard tabs" and "soft tabs" (often with much debate about which is better), but what do the two terms actually mean? I am looking for a simple definition of "soft tabs" and "hard tabs".

Answer

radiantradon picture radiantradon · Oct 14, 2014

Hard tabs use the tab character, http://en.wikipedia.org/wiki/Tab_key#Tab_characters

Soft tabs are just spaces. Soft tabs are usually either 2 or 4 spaces, depending on convention.

If you set your editor to use "soft tabs," when you press the Tab key on your keyboard your editor will insert spaces instead of the tab character.