Skip to content
OddsockLocal
Local
Root font size (px)

--space-10.25rem; /* 4px */

--space-2
0.5rem; /* 8px */
--space-3
0.75rem; /* 12px */
--space-4
1rem; /* 16px */
--space-5
1.5rem; /* 24px */
--space-6
2rem; /* 32px */
:root {Runs in this browser. Nothing is uploaded.

Ready

How to use

  1. Set the base in pixels. 4 or 8 is the usual start.
  2. Set the factor. 2 doubles every step. A smaller factor stays in the range of component padding longer.
  3. Set the number of steps and the root size used to compute rem.
  4. Copy the variables. Do not use the largest step as a gap inside a button.

What is Spacing scale?

Padding that is 13px next to a 16px button is how a layout starts to look slightly drunk. A spacing scale picks a base and a multiplier and sticks to the products. This page writes custom properties, --space-1 onward, in rem, with the pixel value in a comment so you can see both. The opening base is 4px, the factor is 2, there are 6 steps, and the root is 16px. That produces 4, 8, 16, 32, 64, and 128 pixels, written as 0.25rem through 8rem.

Read more

A factor of 2 gets large quickly. Step 6 at 128px is a section gap, not a gap between a label and a field. If you wanted 4, 8, 12, 16, 24, 32, that is not a single ratio, and this page will not invent one. Lower the factor, or take the first few steps and write the in-between values yourself. The type-scale page is the same kind of ladder for font sizes, opening at 16px and a 1.25 ratio, which is a much gentler climb.

The root font size is only the divisor that turns pixels into rem. If your document root is 16px, the comments match what the browser will compute. If a user or a reset changes the root, the rem values follow and the pixel comments stay as the design-time note.

Use cases

  • A design system publishes six spacing tokens from a 4px base.
  • A developer converts a 4, 8, 16, 32 ladder into rem for a stylesheet.
  • A tight UI uses a base of 4 and a factor closer to 1.5 so step 6 is not 128px.
  • A review shows why a 13px gap is off the scale the team agreed to.
  • Someone compares a spacing ladder with the type ladder so they do not share a ratio by accident.

A doubling scale from 4px

Base 4, factor 2, 6 steps, root 16.

:root { --space-1: 0.25rem; /* 4px */ --space-2: 0.5rem; /* 8px */ --space-3: 1rem; /* 16px */ --space-4: 2rem; /* 32px */ --space-5: 4rem; /* 64px */ --space-6: 8rem; /* 128px */ }

Why use Oddsock

Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.

Related tools

Using this tool

Because a factor of 2 compounds. From 4px, six steps lands on 128px. Use that for page sections, or lower the factor if every step should be a component space.