📐UI Whitespace & Density Guide

Guide appropriate whitespace density design standards by content type

8px-Based Spacing Scale

TokenpxremCommon Use
xs4px0.25remIcon internals, badge padding
sm8px0.5remInline spacing, small button padding
md16px1remCard padding, form field gap
lg24px1.5remSection element spacing, card gap
xl32px2remSection dividers, grid gap
2xl48px3remSection spacing, page top margin
3xl64px4remPage sections, hero areas

Principles of UI Whitespace and Density

Whitespace is not empty space — it's a design element that creates visual rhythm. Generous whitespace makes content easier to read, clarifies hierarchy, and builds a premium, trustworthy brand impression. However, data-dense UIs like dashboards need compact spacing to fit more information on screen.

The key is choosing the right density for the content's purpose and context. Reading-focused layouts need loose spacing; data-intensive screens need compact spacing; general product UIs land in the standard middle ground.

Using the 8px Grid System

Setting all spacing values to multiples of 8 (4, 8, 16, 24, 32, 48, 64px) creates visual consistency and simplifies developer handoff. Figma, Material Design, and Tailwind CSS are all built on this system.

Frequently Asked Questions

Does more whitespace make a layout look empty?

More whitespace typically makes content easier to read and the design feel more premium. Only data-dense UIs like dashboards need compact spacing.

What is the ideal line-height for body text?

1.5–1.7 for body text. Headings: 1.1–1.3. UI labels and buttons: 1.2–1.4.

What is the 8px grid system?

A convention where all spacing values are multiples of 8. Most devices render these crisply, and it simplifies collaboration with developers.