Why 8: most screen densities, base font sizes and icon grids are multiples of 2 and 4, so basing everything on 8 still divides evenly (down to 4) and, across common pixel-density ratios (1x, 1.5x, 2x, 3x), multiples of 8 tend to land on whole device pixels instead of blurring.
In practice you predefine a spacing scale as CSS variables: --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px, and so on. Designers snap to an 8px grid in Figma; developers pick from that scale instead of writing an arbitrary padding: 13px.
It's a coordination tool, not a law of physics. The occasional 4px exception for an icon is fine — but if exceptions pile up, the grid stops meaning anything.
When to use
Use it when designers and developers share a team and need consistent spacing across many screens. On a small solo project, enforcing it strictly is usually overkill.