Fixed-price website design from £2,400View Prices

Web Typography: How to Choose and Use Fonts on a Website

How to choose typefaces for a website, set sizes and spacing that are comfortable to read, and load fonts without slowing the page.

Visual Style and Trends guide. 7 minute read, with a live example. Updated .

In short

  • Most of a website is text, so typography does more for its quality than any other design decision.
  • Two typefaces are enough: one for headings and one for body text, or a single family used in several weights.
  • Comfortable reading needs body text of at least 16 pixels, a line height around 1.5 and lines of 45 to 75 characters.
  • Fluid type with clamp() scales headings smoothly between phone and desktop without breakpoints.
  • Fonts are files that have to load. Use modern formats, few weights and font-display: swap so that text appears at once.

Take the images away from most websites and what remains is words: headings, paragraphs, menus, buttons and labels. How those words are set, in which typefaces, at what sizes and with how much space, decides whether a site feels calm or cramped, premium or cheap, easy or tiring. Good typography rarely draws attention to itself. Readers simply find the page pleasant, and trust it a little more.

The principles are old, and the web has made them easier to apply than ever. This guide covers choosing typefaces, setting them well and loading them without a speed penalty.

Choosing Typefaces

A typeface sets the tone before a word is read. The broad families each have a character.

KindCharacterOften used for
SerifTraditional, editorial, authoritativeHeadings for law firms, publishers, hotels and food brands, and long reading text
Sans-serifClean, modern, neutralBody text and interfaces almost everywhere
Slab serifSolid, confident, friendlyHeadlines with personality
MonospaceTechnical, preciseCode, data and small labels
Script and displayDecorative, distinctiveA logo or a few words. Never paragraphs.
  • Choose the body typeface first. It carries most of the words and has to be effortless to read at small sizes.
  • Check that the family has the weights and styles you need, including a true italic and a bold.
  • Check the characters you will use: pound signs, accented letters and the figures in prices.
  • Test it on a phone and on an ordinary laptop screen, not only on a designer's display.
  • Make sure the licence covers use on a website.

Typefaces are settled at the visual design stage of a project, alongside colour, as our guide to the website design process explains.

Pairing Fonts

Two typefaces are enough for almost any website, and one is often plenty. The classic pairing is contrast with a shared feel: a serif for headings with a sans-serif for text, or the reverse. Two typefaces that are nearly alike look like a mistake.

  • Pair a typeface with character for headings with a quiet one for body text.
  • Or use a single family and create the hierarchy with size and weight alone.
  • Be wary of adding a third family. Each one adds visual noise and loading time, so it should have a clear job of its own.
  • Keep decorative typefaces for very short text.

Size, Line Height and Line Length

Three measurements decide whether text is comfortable to read.

SettingGuidelineWhy
Body sizeAt least 16 pixels, and often 17 to 20 on larger screensSmaller text strains the eyes
Line heightAbout 1.5 for body text, and tighter for large headingsLines need air between them, and headings look loose with too much
Line length45 to 75 charactersLonger lines make it hard to find the start of the next one. Much shorter ones break up the rhythm.
body {
  font-size: 1.125rem;
  line-height: 1.6;
}

p, li {
  max-width: 68ch;
}

h1, h2, h3 {
  line-height: 1.15;
  text-wrap: balance;
}
Body text of 18 pixels with generous line height, lines limited to about 68 characters and headings that wrap into balanced lines.

Set sizes in rem, not pixels, so that they respect the text size a visitor has chosen in their browser. The text-wrap: balance rule evens out the lines of a heading, so that one word is not left alone at the end. It is supported in all current browsers. Spacing is covered further in our guide to white space.

A Type Scale and Fluid Type

A type scale is a fixed set of sizes, each a consistent step larger than the last, used for every piece of text on the site. It gives headings clear levels and stops sizes multiplying. The steps should be larger on a wide screen, where a big headline has room, and smaller on a phone.

Fluid type handles that change smoothly. The clamp() function sets a minimum, a preferred value that grows with the width of the screen, and a maximum.

:root {
  --text-s: 0.9rem;
  --text-base: 1.125rem;
  --text-l: clamp(1.3rem, 1.2rem + 0.5vw, 1.6rem);
  --text-xl: clamp(1.7rem, 1.4rem + 1.5vw, 2.5rem);
  --text-xxl: clamp(2.3rem, 1.5rem + 3.6vw, 4.2rem);
}

h1 { font-size: var(--text-xxl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-l); }
A five-step type scale. The larger steps grow with the screen between a minimum and a maximum, with no media queries.
Live example
--text-xxl
Page heading
--text-xl
Section heading
--text-l
Sub-heading
--text-base
Body text, at a size that is comfortable to read.
--text-s
Captions and small print.
The scale above at its real sizes, with the current size of each step beside its name. Make the window narrower or wider and the three largest steps change smoothly, while the two smallest stay fixed.

Tip: Always combine a viewport unit with a rem value inside clamp(), as above. Text sized in vw alone does not respond when a visitor zooms in, which is an accessibility failure.

Web Fonts, System Fonts and Variable Fonts

OptionWhat it isTrade-off
System fontsThe fonts already on the visitor's deviceInstant and free, but the site looks slightly different on each platform and is less distinctive
Web fontsFont files the site supplies or loads from a serviceConsistent and on-brand, at the cost of extra downloads
Variable fontsOne file containing a whole range of weights and widthsFlexible, and often smaller than several separate files

A variable font replaces separate files for regular, medium, bold and so on with a single file in which the weight, and sometimes the width or slant, can be set to any value. That allows finer control, such as a slightly heavier weight for small text, and usually means fewer downloads.

Loading Fonts Without Slowing the Site

Every web font is a file the browser has to fetch before it can draw text in that typeface. Handled carelessly, fonts delay the first words on the page or make them jump when the font arrives.

@font-face {
  font-family: "Example Sans";
  src: url("/fonts/example-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

body {
  font-family: "Example Sans", system-ui, sans-serif;
}
A variable font in WOFF2 format covering weights 400 to 700, with text shown in a fallback font until it has loaded.
  • Use the WOFF2 format, which every current browser supports and which compresses best.
  • Load only the weights and styles you use. Each one is a separate download unless the font is variable.
  • Host the files on your own domain where the licence allows, which avoids an extra connection.
  • Set font-display: swap so that text is visible immediately in a fallback font.
  • Choose a fallback with similar proportions, so that the text barely moves when the web font takes over.
  • Preload the one or two fonts used at the top of the page.

Font loading affects two of the Core Web Vitals: how quickly the main content appears and whether the layout shifts. Our guide to website speed optimisation covers the rest.

Typography and Accessibility

  • Keep text as real text. Words inside images cannot be resized, translated or read aloud.
  • Give text enough contrast against its background, as set out in our guide to website colour schemes.
  • Align paragraphs to the left. Justified text creates uneven gaps that many readers find difficult, and centred paragraphs are hard to follow.
  • Use capital letters sparingly. Long passages in capitals are slower to read.
  • Make sure the page still works when the text is enlarged to twice its size.
  • Use real headings in the right order, because people using screen readers move through a page by them.

Common Typography Mistakes

  • Too many typefaces. Several unrelated families make a page look disorganised.
  • Body text too small. Text under 16 pixels on a phone is a strain.
  • Lines too long. Text that runs the full width of a large monitor is tiring.
  • Light grey text. Thin, pale type looks refined in a mock-up and is unreadable in daylight.
  • Tight line spacing. Paragraphs need room between the lines.
  • Too many weights loaded. Six font files for a site that uses two.
  • Headings chosen by size. Picking a heading level for its looks breaks the structure of the page.

Putting It Into Practice

Reading about a technique is the easy part. Applying it to a real business, with real content and a launch date, takes judgement about what to use and what to leave out. DigitalPod is a UK-based design and web development studio that designs every site from a blank page and builds it by hand, so a technique is used because it helps the business and not because a template came with it. If you would like a website designer to handle it for you, startup website design is what we specialise in, websites start from £2,400 and our website redesign service brings an older site up to date.

Frequently Asked Questions

What is the best font for a website?

There is no single best font. For body text, choose a typeface designed for screens that is easy to read at small sizes, has the weights you need and suits the character of the business. Well-made sans-serifs are the safest choice for text, and headings can carry more personality.

How many fonts should a website use?

Two is enough for almost every site: one for headings and one for body text. A single family in several weights also works well. Each additional typeface adds visual clutter and another file for the browser to download.

What font size should website text be?

Body text should be at least 16 pixels, and 17 to 20 pixels is often more comfortable on larger screens. Set it in rem units so that it respects the visitor's own settings, and make sure headings are clearly larger than the text beneath them.

What is a variable font?

A variable font is a single font file that contains a continuous range of weights, and sometimes widths or slants, instead of one file for each style. It gives designers finer control and usually means fewer downloads than loading several separate files.

Do web fonts slow down a website?

They can, because each font is a file that must be downloaded. The effect is small if you use the WOFF2 format, load only the weights you need, host the files yourself where the licence allows and set font-display: swap so that text appears straight away.

Want a Website Built This Way?

DigitalPod designs and builds websites for startups and growing UK businesses, with everything handled in-house from the first sketch to launch. Startup website design starts from £2,400, or you can read what clients say in our Trustpilot reviews.

Get a quote

Related Web Design Techniques

More from our web design techniques guides. For costs, briefs and choosing a designer, see the startup blog.