Layout
Spacing Scale
A spacing scale is a rule that restricts spacing values to multiples of one predefined unit instead of any arbitrary number.
Definition
A spacing scale is a rule that stops you from picking spacing values at random and instead lets you choose only from multiples of a unit you decided on ahead of time. For example, you might allow only values like 4, 8, 16, 24, and 32, and always pick from within that set. Rather than reaching for 13px, 17px, or 21px on a whim, you select values from the fixed rungs of a ladder. When your options shrink to a handful, decisions get faster, and the spacing across every corner of the screen ends up sharing the same reference, which gives the whole layout a consistent rhythm. That rhythm is hard to spot directly, but it is the main reason a screen reads as tidy. A scale is not limited to spacing either — you can apply the same idea to element sizes and corner radii, so the entire interface moves on one coherent system.
Why does it matter?
Spacing values chosen without a rule can each look fine on their own, but once several of them sit together they drift slightly out of line and the whole screen feels messy. The human eye barely notices the difference between 15px and 16px, yet it strangely does pick up on the disorder of values that are all over the place. A scale makes those vague inconsistencies disappear and aligns every gap to the same baseline, so the screen looks organized without adding a single color or line. Because the set of values is fixed, designers and developers can also talk in a shared language like "give it one more step of space," and when you need to adjust spacing later you can change it predictably by following the rule, which makes maintenance far easier. In the end, a scale turns spacing that used to depend on one person's instinct into a system the whole team shares.
Common mistakes
- Setting up a scale and then slipping in exception values whenever things get busy. Once one or two exceptions pile up, the rule quietly falls apart, and you end up no better off than if you had never used a scale at all.
- Making the steps too fine-grained. When the values sit as close as 4, 6, 8, 10, 12, the differences between them are hard to see, so splitting them serves no purpose and actually makes choosing harder.
- Leaving the scale only in documentation and never wiring it to the real values in your code. When the rule and the code live apart, they drift over time until no one trusts the rule anymore, and everyone goes back to scattered values.
Practical tips
- The most widely used starting point is the "8-point grid," which takes 8 as the base unit. Because the values are multiples of 8, a rhythm emerges to the eye and awkward numbers like 15px vanish, making it easier for designers and developers to stay in sync. When you need smaller gaps, pair 4 in as a secondary unit.
- Give your scale values token names instead of raw numbers. When you call them by name, changing the base unit later means editing one place and having it apply everywhere, which makes spacing adjustments much safer. This habit of managing values by name naturally leads into the larger system of design tokens.
Ask your AI
In the CSS/JSX I'm pasting below, find every margin, padding, and gap value and snap each one to the nearest rung of an 8-point grid (4, 8, 16, 24, 32, 48, 64) built on a base unit of 8. Rewrite off-grid values like 13px, 17px, or 21px to the closest multiple of 8, and only allow the secondary unit 4 for very small gaps. Pull the results into --space-* CSS variables and give me a table mapping each original value to its new one.
This product is [product type — e.g., a data-dense admin dashboard]. Design a spacing scale that fits it. Build it on an 8-point grid with 8 as the base unit, add 4 as a secondary unit for small gaps, and lay out 5-7 steps like 4, 8, 16, 24, 32, 48, 64 — and avoid cramped scales like 4, 6, 8, 10 where the steps sit too close to tell apart. Give each step a token name like --space-1 instead of a raw number, output it as a CSS variable set noted in both px and rem, and add a one-line note on where each step is best used.
Review the code I'm pasting below to see whether it sticks to an 8-point grid (multiples of 8, with 4 allowed only for small gaps). Find every spacing value that isn't a multiple of 8 or 4 (like 13px, 17px, 21px), any exception values that aren't in the scale, and any spots where the steps are too fine-grained to distinguish, and collect them into a list of violations. For each one, suggest which scale value it should become, and flag any tokens that live only in docs but aren't wired to the real values in the code. Don't rewrite the code — just give me the audit as a table.