Skip to content
hateitall

Spacing Scale Generator

Replace one-off margins with a short, consistent set of spacing tokens.

Processed locallyIn: NumberOut: CSS custom properties, JSON, Tailwind theme

Loading tool…

How to use spacing scale generator

  1. Choose the scale type: multiples, Tailwind steps, a ratio or a custom list.

  2. Set the base unit and the number of steps, and your root font size.

  3. Pick rem or px output and how tokens are named.

  4. Copy the CSS custom properties, the Tailwind 4 @theme block or the JSON tokens.

What this tool does

  • Four ways to build a scale: even multiples, Tailwind's default steps, a geometric ratio or your own values.
  • Names tokens by number, by size (xs, md, xl) or by pixel value.
  • Shows every step as a bar so the jumps are easy to judge.
  • Outputs CSS variables, a Tailwind 4 @theme block and JSON from the same scale.

How the result is verified

Each token shows its px value next to the output; for rem output, the rem value times the root size gives that px value back.

Frequently asked questions

Should spacing use a 4px or 8px base?

8px keeps choices few and lines up with most screen sizes; 4px adds half steps for dense interfaces such as tables and forms. Many systems use 4px steps up to 16px and 8px steps after that.

rem or px for spacing?

rem makes spacing grow when someone raises their browser font size, keeping proportions with text. px keeps spacing fixed. Both are common; pick one and keep to it.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

px, rem and em both ways with any root size, plus bulk CSS rewrite

Number · CSS→ NumberLight on device

Modular type scale with common ratios, fluid option and CSS variables

Number→ CSS custom propertiesLight on device