About Spacing Scale Generator
A spacing scale is the short list of sizes a design uses for padding, margins and gaps. Choose a base unit, such as 4px or 8px, and how the steps grow: plain multiples, a doubling sequence that stays fine at the small end and coarse at the large end, or a fixed ratio.
The preview draws every step as a bar at its real width. Copy the scale in rem or px as CSS custom properties, SCSS variables or JSON design tokens, with steps named by position or by their pixel value.
How it works
- Multiples give base × 1, 2, 3 and so on. Doubling gives base × 1, 2, 3, 4, 6, 8, 12, 16, 24…, where each pair after 2 is three and four times a power of two.
- A ratio scale multiplies each step by the ratio. Rounded to whole pixels, steps that land on the same pixel are kept once.
- Sizes are divided by the root font size for rem and rounded to four decimals. A pixel value with a fraction is named with an underscore, so 1.5px becomes space-1_5.
Questions
Should spacing be in rem or px?
Rem spacing grows when a reader increases their default font size, which keeps text and the space around it in proportion. Px spacing stays fixed. Many systems use rem for layout spacing and px for hairline details such as borders.
How many steps do I need?
Most interfaces get by with eight to twelve. Fewer steps make choices easier and layouts more consistent; you can always add one later.
Can I use these tokens with a design tool?
The JSON uses the $value and $type fields of the W3C design tokens draft format, which token plugins and build tools such as Style Dictionary can read.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.