8px Grid Calculator

Enter a size and the grid unit (8px by default) to get the nearest multiple and the values just below and above it. A spacing scale of 1× to 12× the unit is listed in px and rem.

px
px

8 is the usual base; 4 for finer steps.

Nearest

24px

3 × 8

Round down

24px

Round up

32px

Spacing scale on a 8px grid

StepPixelsrem (16px root)
1×8px0.5rem
2×16px1rem
3×24px1.5rem
4×32px2rem
5×40px2.5rem
6×48px3rem
7×56px3.5rem
8×64px4rem
9×72px4.5rem
10×80px5rem
11×88px5.5rem
12×96px6rem

Features

  • Nearest, lower and higher grid value

  • 8px, 4px or any grid unit

  • Tells you when a size is already on the grid

  • Spacing scale from 1× to 12×

  • Scale values in px and rem

When to use it

UI design

Keep paddings, margins and component heights on an 8-point grid so layouts line up.

Design handoff

Round odd sizes from a mock-up, like 27px, to the grid value developers should use.

Design tokens

Generate a spacing scale for a CSS or Tailwind theme.

Frequently Asked Questions

Worked example

A mock-up has a card with 27px padding and a 45px tall button on an 8px grid.

  • Padding: 27 ÷ 8 = 3.375, nearest 3 × 8 = 24px (round up gives 32px)
  • Button: 45 ÷ 8 = 5.625, nearest 6 × 8 = 48px

Related: PX to REM Converter, Golden Ratio Calculator, Viewport Unit Calculator.