consolelog.tools

Spacing Scale Calculator

Generate a coherent spacing system from one base unit — linear, geometric, modular, or Fibonacci — with numeric or t-shirt names and px/rem values per step. A live visual ruler and an applied-layout demo show the rhythm as you edit, an audit flags fractional-pixel and runaway steps, and you can export to CSS variables, Tailwind v4 @theme, Tailwind v3 config, SCSS, or JSON — with optional margin/padding/gap utilities.

About this ToolHow it works, benefits & use cases

Most spacing tools spit out a flat list of numbers. This one builds a real spacing system you can see and feel before you ship it. Pick a base unit and a progression — linear (multiply the base by each step), geometric or modular (compound by a ratio, the same maths typographers use for type scales), or Fibonacci (1, 2, 3, 5, 8…) — and choose numeric or t-shirt (xs, sm, md, lg…) token names. A live visual ruler renders every step proportionally, and an applied-layout demo wires the same tokens into real card padding and gaps so you can judge the vertical rhythm, not just read pixel values. A built-in audit flags fractional-pixel steps that blur on 1× displays and runaway top-end sizes. Every step is computed in both px and rem (normalised against a root size you set), and you can export to CSS custom properties, Tailwind v4 @theme, a Tailwind v3 config, an SCSS map, or JSON — optionally bundling margin, padding, and gap utility classes. The whole configuration lives in a shareable URL.

How to Use

  1. 1Start from a preset (Tailwind 4px, Material 8px, Golden ratio, Major third, or Fibonacci) or set the base unit yourself.
  2. 2Choose a scale type — Linear, Geometric, Modular, or Fibonacci — and set the number of steps.
  3. 3For Geometric or Modular scales, set the ratio that compounds each step (e.g. 1.5, 1.618, 1.25).
  4. 4Pick your unit (rem or px) and root size for rem conversion, and a numeric or t-shirt naming scheme.
  5. 5Watch the visual ruler and applied-layout demo update live, and check the audit for fractional-pixel or oversized warnings.
  6. 6Choose an export format, optionally enable utility classes, then copy, download, or share the generated code.

Key Benefits

  • Four progression models: linear, geometric, modular (type-scale) ratios, and Fibonacci
  • Numeric or t-shirt token naming, with px and rem computed per step
  • Live visual ruler plus an applied-layout demo that shows real padding and gaps
  • Audit warns about fractional pixels, runaway top-end steps, and bad ratios
  • Five export formats: CSS variables, Tailwind v4 @theme, Tailwind v3 config, SCSS map, and JSON
  • Optional margin / padding / gap utility-class generation for CSS and SCSS
  • Adjustable root size for accurate rem conversion, and a shareable URL for handoff

Common Use Cases

  • Defining a 4px or 8px spacing foundation for a new component library
  • Generating Tailwind v4 @theme spacing tokens or a v3 config that matches an existing design
  • Producing CSS margin/padding/gap utilities without hand-writing dozens of classes
  • Comparing geometric, modular, and Fibonacci rhythms visually before standardising
  • Exporting a JSON token file with px and rem values for a design-token pipeline
  • Sharing an exact spacing spec with a teammate via a single link
Visual ruler
0
0
1
0.25rem · 4px
2
0.375rem · 6px
3
0.5625rem · 9px
4
0.8438rem · 13.5px
5
1.2656rem · 20.25px
6
1.8988rem · 30.38px
7
2.8475rem · 45.56px
8
4.2713rem · 68.34px
9
6.4075rem · 102.52px
Applied to a layout
PricingNew

Spacing derived from your scale drives this card's padding and gaps.

TagTagTag
6 steps resolve to fractional pixels (e.g. 4 = 13.5px), which can blur on 1× displays.

CSS variables — updates live

:root {
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.375rem;
  --space-3: 0.5625rem;
  --space-4: 0.8438rem;
  --space-5: 1.2656rem;
  --space-6: 1.8988rem;
  --space-7: 2.8475rem;
  --space-8: 4.2713rem;
  --space-9: 6.4075rem;
}

Start from a preset

Scale

px

Units & naming

px

Export format

Applies to the CSS variables and SCSS map exports.

Pick a progression, not a pile of numbers

A spacing scale grows your base unit by a predictable rule. Linear multiplies the base by each step (a 4px grid: 4, 8, 12…). Geometric and modular compound by a ratio so gaps accelerate — the same maths typographers use for type scales. Fibonacci follows 1, 2, 3, 5, 8… for an organic rhythm.

Why the ruler and the demo

Numbers in a table hide whether a scale actually feels right. The ruler shows each step proportionally, and the applied-layout demo wires the same tokens into real gaps and padding so you see the vertical rhythm before you commit — then export the exact set you previewed.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools