Web Typography Cheatsheet
01 Fluid type — clamp() generator
Inputs
Click to copy
Viewport preview
The quick brown fox
Full scale — uses your viewport settings
Roleclamp() valuerem range
01Type scale — desktop
H1 Page title
H1
32–40px / 700
lh 1.1 / −0.02em
H2 Section heading
H2
24–32px / 600
lh 1.2 / −0.01em
H3 Subsection title
H3
20–28px / 600
lh 1.3 / track 0
H4 Component title
H4
18–22px / 500
lh 1.4 / track 0
Body — the quick brown fox jumps over the lazy dog and keeps on going.
Body
16–18px / 400
lh 1.6–1.7
Small / caption — supporting text, labels, metadata
Small
13–14px / 400
lh 1.5
Eyebrow / Overline
Eyebrow
10–12px / 500
UPPER / +0.08em
02Line length & spacing
PropertyValueNote
Ideal line length55–75 chscales with font in use
Max content width65chmax-width: 65ch on prose
Body line-height1.6–1.7unitless — always
Heading line-height1.1–1.3tighter as size grows
Paragraph spacing1–1.5emmargin-bottom on p
Space after heading0.5–0.75emcloser to its content
Space before heading1.5–2emseparates from prior section
Min font size0.8125rem13px — never below
Base font unitremrespects browser accessibility prefs
03Contrast & readability
RoleExampleRatioWCAG
Body on white#1a1a1a16:1AAA
Secondary text#6b6b6b5.7:1AA
Placeholder / hint#9ca3af2.5:1Large only
Min body text4.5:1AA required
Min large text3:118px+ or 14px boldAA required
04Responsive scaling
PropertyValueNote
Mobile body0.9375rem15px — slightly larger than desktop
Mobile H11.625–1.875rem26–30px — scale down significantly
Fluid type methodclamp()see Calculator tab
Breakpoint768pxcommon switch for type scale
Mobile line lengthautoremove max-width on small screens
05Dos & don'ts
Do
Use rem for all font sizes
Limit to 2 typefaces per page
Use weight to create hierarchy
Set max-width on prose in ch units
Use unitless line-height
Test at 120% browser zoom
Left-align body copy
Don't
Use px for font-size (blocks a11y zoom)
Use more than 3 sizes in one component
Justify body text on the web
Go below 0.8125rem (13px)
Set line-height in px
Use light weights below 1rem
Centre-align long paragraphs
01The scale
spacing = n × 8px
where n = 0.5, 1, 1.5, 2, 3, 4, 6, 8, 10 — every spacing value should be a multiple of 8 (or 4 for micro-gaps).
4px
micro gap, tight badge padding, icon offset0.25rem
8px
inline padding, chip gaps, icon-to-label0.5rem
12px
compact list padding, tight label spacing0.75rem
16px
input padding, small card gap, body margin1rem
24px
card padding, between form fields, paragraph gap1.5rem
32px
section internal spacing, modal padding2rem
48px
between content sections, hero sub-elements3rem
64px
section vertical padding, generous breathing room4rem
80px
page section breaks, hero top/bottom padding5rem
02On-grid vs off-grid
On grid
padding: 16px 24px
gap: 8px
margin-bottom: 32px
padding: 4px 8px
margin-top: 48px
border-radius: 8px
Off grid
padding: 15px 22px
gap: 10px
margin-bottom: 30px
padding: 5px 9px
margin-top: 50px
border-radius: 6px

When something feels slightly off but you can't explain why, check for values like 10px, 15px, or 22px. Snapping to the nearest multiple of 8 fixes it almost every time.