How to set up a spacing scale for a design system from scratch
A spacing scale replaces arbitrary pixel values with a small, predictable set of options. It makes layouts more consistent and speeds up decisions for designers and developers.
Step 1: choose a base unit 4 px and 8 px are the most common. A 4-based scale gives finer control for small components; an 8-based scale feels more structured for layout.
Step 2: define the steps A typical scale might look like: 2, 4, 8, 12, 16, 24, 32, 48, 64, 96. Smaller steps are close together, larger ones further apart, because the difference between 4 and 8 px is very noticeable while the difference between 92 and 96 px is not.
Step 3: name the tokens Options include:
- Numeric: space-100, space-200, space-300. Easy to extend.
- T-shirt sizes: xs, sm, md, lg, xl. Intuitive, but awkward when you need something between two sizes.
- Multiplier-based: space-1 = 4 px, space-2 = 8 px. Clear relationship to the base.
Step 4: document usage
- Which values for padding inside components vs gaps between components vs page sections.
- Related elements closer together, unrelated ones further apart (the proximity principle).
Step 5: implement in design and code
- Variables in your design tool.
- Tokens in code (CSS custom properties or a token pipeline).
- Auto layout and layout utilities using only scale values.
Step 6: audit and adjust Check existing designs to see which values are actually used, and adjust before locking the scale.
Do you use a 4 or 8 base? How do you name your spacing tokens?
Comments · 2
Base unit of 4 or 8 pixels with a limited ladder (4, 8, 12, 16, 24, 32). A smaller set of options makes it easy to build consistent layouts.
Name the steps by meaning or size, like space-sm and space-md, not pixel values. Then you can change the scale without renaming everything.