Readable font size and line spacing
Set body text relative to the visitor's own size, and give lines a plain-number line height of at least 1.5. Those two habits cover most of it.12
Font size
- Don't fight the default. Browsers start with a default text size, which is usually 16px for body text.1 Many visitors change it in their settings, and you want your page to follow.
- Use relative units. It's generally best to use values relative to the user's default font size.1 The units
emandremdo this. - Prefer
remfor most text. Aremvalue is relative to the roothtmlelement, not the parent element.1 That avoids sizes stacking up as one element sits inside another. - Be careful with pixels. Setting sizes in
pxcan stop visitors changing the size in some browsers.1 That's a problem for anyone with limited vision.
Line spacing
Line spacing is the height of each line of text. CSS calls it line-height.
- Aim for at least 1.5 on paragraphs. The documentation recommends a minimum value of 1.5 for main paragraph content.2
- Why it helps. It can help people with low vision, and people with cognitive concerns such as dyslexia.2
- Write it as a plain number. Write
line-height: 1.5, not1.5emor a percentage. A plain number is generally the preferred way, because it avoids unexpected results from inheritance.2 - It scales when people zoom. When a page is zoomed to enlarge text, a unitless value makes the line height scale along with it.2
A starting stylesheet
In plain words: set the body size to one rem and the body line height to a plain 1.5.12 That's the whole starting point. Headings can have a different line height, since they're usually short. Check them on the page.
Phone and desktop
Nothing in the sources says a phone needs a different base size from a desktop. The safest approach is to let the visitor's settings do the work. Then check both.
- Open your page on a real phone and on a computer.
- Read a full paragraph without leaning in.
- Zoom the page in. Does anything overlap or get cut off?
- Change the browser's default text size in its settings. Does your page follow it?
If step four doesn't work, look for sizes set in pixels.
Common slip-ups
- Setting body text smaller to fit more on the screen. Visitors then have to zoom.
- Using a fixed line height in pixels, so text lines crowd together once it's enlarged.
- Mixing many sizes. A base size, a heading size or two, and a small size for notes is enough for most small sites.
Text also needs enough contrast against its background. The contrast ratios page explains the minimums. If you haven't picked a typeface yet, start with the font checklist.
Where the facts come from
- font-size, MDN Web Docs
- line-height, MDN Web Docs