Tailwind Spacing Scale Generator

Choose a base unit and a progression and get a spacing scale as Tailwind v4 theme variables, a v3 config block, CSS custom properties and a table of pixel and rem values.

Use the tool

Why this tool exists

Spacing is where design systems drift. One screen uses 12px, the next 14px, and nobody remembers the rule. A fixed scale built from a base unit, such as a 4px or 8pt grid, keeps layouts consistent and makes review easier because values are either on the scale or not.

This generator lets you try different progressions before you commit: linear steps, doubling, a modular ratio or Fibonacci. It then writes the scale in the formats you need, with pixel and rem values side by side so you can check it against your root font size. The calculation runs in your browser, so you can experiment freely and copy only the version you like.

How to use it

  1. Set the base unit in pixels, for example 4 for a 4px grid or 8 for an 8pt grid.
  2. Choose a progression: linear, doubling, modular ratio or Fibonacci, and set the number of steps.
  3. Pick how the steps are named and set the root font size used for rem values.
  4. Copy the Tailwind v4 theme block, the v3 config or the CSS custom properties.

Frequently asked questions

Which progression should I choose?

Linear suits dense interfaces that need fine control. Doubling and modular scales grow faster and suit marketing pages or type-led layouts. Fibonacci sits between them. Try each and look at the pixel table.

How are the values named?

You can use numbers, t-shirt sizes such as xs, sm and md, or the pixel value itself. Numbers are the easiest to remember, while the pixel names make the output self-explanatory.

Why does the tool ask for a root font size?

Tailwind spacing is expressed in rem. The root size, normally 16px, converts your pixel steps into rem so that the scale follows a user's browser font settings.