Always spaces, never tabs

Objective arguments that decided my personal preference.

published 2020-Oct-23, updated 2024-Feb-16

TLDR: always spaces, never tabs; 2 spaces rather than 4.

Arguments

Objective arguments in favor of spaces over tabs:

Objective arguments in favor of tabs:

Objective arguments in favor of 2 spaces over 4 spaces:

Objective arguments in favor of 2 spaces over 1 space:

Bias

Your preference is influenced by your display pixel density, resolution, OS, font family, font size, eyesight, and habits. Someone with a very large but low-DPI display is likely to prefer 4 spaces. Someone who writes code on a small display, in an IDE that uses 20% of the screen area for the actual code, is likely to prefer 2 spaces.

If you don't have a strong preference, 2 spaces seems like a better default, based on the arguments above.