Convert pixels to design-system base units using a configurable base size (8px by default). This maps a raw pixel value onto your token scale so spacing stays on the grid. The table below uses an 8px base.
| Pixels | Base units |
|---|---|
| 4px | 0.5 |
| 8px | 1 |
| 16px | 2 |
| 24px | 3 |
| 32px | 4 |
| 40px | 5 |
| 48px | 6 |
| 64px | 8 |
| 80px | 10 |
| 96px | 12 |
Divide the pixel value by your chosen base unit. At base 8: 24px ÷ 8 = 3 units, 48px ÷ 8 = 6 units, 16px ÷ 8 = 2 units. At base 4 (Tailwind): 24px ÷ 4 = 6 units. This calculator does the division for you — type the pixel value and read the unit equivalent. Useful when auditing a design that uses pixel values to see whether it conforms to your design system's spacing scale.
You'll see a fractional unit value like 2.5 (20px at base 8) or 1.75 (14px at base 8). Fractional units may indicate the design isn't conforming to your spacing scale — the designer used an arbitrary pixel value rather than a grid-aligned one. Some design systems accept half-units (0.5, 1.5, 2.5) as legitimate; others enforce whole units only. Use this calculator to spot off-grid values during design QA.
Mainly for design-system migrations and audits. If your team has decided to switch from pixel-based CSS to a base-unit system (or vice-versa), this calculator helps translate every existing value. It's also useful for designer-developer handoff: a designer hands you a 36px gap, you check that it maps to a clean 4.5 units (Material Design half-unit) versus an arbitrary value.
4px works well for Tailwind users — Tailwind's spacing scale is already 4-based. 8px works well for Material Design or visually rounder spacing. 10px is rare but appears in some accessibility-focused systems because it lets you think in percentages of the root rem (when root is set to 62.5%). Most modern teams pick 4 or 8 and stay consistent.
Inverse of Base Unit→PX: units = px / baseSize. This tool helps developers map arbitrary pixel values back to their design token equivalents, ensuring layouts stay on-grid. The configurable base (default 8px) can be set to match any design system — 4px (Tailwind default), 8px (Material), or project-specific values.