Token table · click any token to copy its var() reference
Advertisement
Base16px
Ratio1.500
Steps8
NamingT-shirt
Unitrem
About this generator
Build a modular CSS spacing scale from a base size + a musical ratio. 8 ratio presets covering the classic intervals — minor 2nd (1.067), major 2nd (1.125), minor 3rd (1.2), major 3rd (1.25), perfect 4th (1.333), augmented 4th √2 (1.414), perfect 5th (1.5), golden φ (1.618). 4-12 steps with a configurable base-index so you get sizes both below and above your base.
Visual cascade — size-proportional rectangles let you see at a glance whether step-3 is too close to step-4 or whether the ratio is too tight / too loose. Token table below — click any token to copy its var() reference.
AI gives you 4, 6, 9, 14, 21px. This shows the same scale as side-by-side rectangles so you can SEE if step-3 is too close to step-4 — visual judgment beats arithmetic.
⊞
8 modular ratio presets
Minor 2nd through Golden ratio — the same modular scales used in print typography for centuries. Pick one or type any custom ratio.
rem scales with the user's browser font-size. Users with vision needs bump font-size up; rem-based spacing scales with them. Px-only spacing breaks accessibility.
02
Keep the scale small
Six steps (xs, sm, md, lg, xl, 2xl) covers 99% of UI needs. Adding 3xs through 6xl looks comprehensive but you'll never use them — every extra token is decision overhead.
03
Match spacing to type
If your type scale uses 1.25 ratio, your spacing scale should too. Mismatched ratios feel subtly wrong even when individual values look correct.
04
Base index = your md
The base step is what your default `padding` and `gap` use. Set it to wherever your "comfortable" UI density sits — usually 16px for content, 12px for dense data tables.