Apollo Editor
Windows 10 & 11 Buy now · $69.95
Design & SEO

How to Use Google Fonts and Other Web Fonts on Your Website

How to add Google Fonts or self-hosted web fonts to your site, choose readable font pairs, and keep fonts fast and privacy-friendly.

Updated 5 minute read The Apollo Editor team

To use Google Fonts, pick a font at fonts.google.com, copy the <link> tag it gives you into the <head> of your pages, then apply the font in your CSS with font-family. Alternatively, download the font files, put them in your site folder and load them with an @font-face rule, which is called self-hosting. Either way, stick to one or two families and only the weights you actually use.

This guide covers both methods step by step, how to choose readable fonts, how to keep them fast, and the privacy points to consider.

What web fonts are

Without web fonts, a page can only use fonts already installed on the visitor's device, which is why older sites relied on "web safe" fonts like Arial, Georgia and Verdana. Web fonts are font files the browser downloads with your page, so every visitor sees the typeface you chose.

Google Fonts is a large free library of these fonts. Most are released under the SIL Open Font License and some under the Apache License. Both are open licenses that allow use on websites, including commercial ones. Other sources of web fonts exist too, but check each font's license before using it on a site.

This is the quickest way and needs no font files on your server.

  1. Go to fonts.google.com and open a font, for example Inter or Lora.
  2. Choose the styles you need, such as Regular 400 and Bold 700, and get the embed code.
  3. Paste the tags into the <head> of every page, before your own stylesheet. They look similar to this:
  • <link rel="preconnect" href="https://fonts.googleapis.com">
  • <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  • <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap">

Then use the font in your CSS, always with a fallback at the end:

  • body { font-family: "Inter", Arial, sans-serif; }

The preconnect lines let the browser start connecting to Google's servers early. The display=swap part shows text in a fallback font straight away and swaps in the web font once it arrives, so visitors are never left looking at invisible text.

To load two families, add a second family= parameter to the same URL, for example family=Inter:wght@400;700&family=Lora:ital@0;1. The Google Fonts site builds this for you when you select more than one font.

Method 2: self-host the font files

Self-hosting means the font files live on your own server alongside your HTML and CSS. The browser does not need to contact another company's server, and your site keeps working the same way whatever happens elsewhere.

  1. Get the files. Download the family from Google Fonts or the font's official source. For the web, you want WOFF2 files, which are compressed and supported by all modern browsers. If you only have TTF files, a font conversion tool can produce WOFF2.
  2. Add them to your site, for example in a fonts/ folder.
  3. Declare each file in your CSS with an @font-face rule, one per weight and style:
  • @font-face {
  • font-family: "Inter";
  • src: url("../fonts/inter-400.woff2") format("woff2");
  • font-weight: 400;
  • font-style: normal;
  • font-display: swap;
  • }

Repeat the rule for bold (with font-weight: 700 and the bold file) and italic if you need them. Then use font-family: "Inter", Arial, sans-serif; exactly as in method 1. The path in url() is relative to the CSS file, not the HTML page, which is a common source of fonts that fail to load.

Keep the license file that comes with the font in your project. Open font licenses allow redistribution, which is what self-hosting is, as long as the terms are followed.

Linking or self-hosting: which to choose

Link to Google FontsSelf-host
SetupCopy and paste a few tagsDownload files and write @font-face rules
Requests to other serversYes, to GoogleNo
UpdatesHandled by GoogleYou update files yourself
Works when previewing offlineNoYes
PrivacyVisitor IP addresses reach GoogleNothing goes to a third party

A note on privacy in Europe

When a page links to Google Fonts, each visitor's browser connects to Google, which means their IP address is sent to Google. In early 2022, a regional court in Munich, Germany ruled that a website embedding Google Fonts this way, without the visitor's consent, breached the GDPR, and awarded the visitor damages. Many sites that serve visitors in the European Union now self-host their fonts to avoid the issue. If this applies to you, self-hosting is the simplest route. For questions about your own legal obligations, ask a qualified advisor.

Choosing readable fonts

  • Use one or two families. One for headings and one for body text is plenty. A single family in two weights can look just as polished.
  • Pick a body font built for screens. Look for open letter shapes, clear differences between similar characters (such as l, I and 1) and a comfortable x-height.
  • Pair contrasting styles. A serif heading font with a sans-serif body font, or the other way around, is a classic combination.
  • Use a sensible size. Around 16 pixels or larger for body text, with a line height around 1.5.
  • Test real content. Look at a full paragraph, headings, numbers and buttons, on a phone as well as a desktop.

Keeping fonts fast

Each weight and style is a separate download. Loading Regular, Medium, Semibold, Bold and their italics adds up quickly.

  • Load only the weights you use. Two or three is usually enough.
  • Use font-display: swap (or display=swap in the Google Fonts URL) so text appears immediately.
  • Prefer WOFF2 when self-hosting.
  • Consider variable fonts. Many Google Fonts are available as variable fonts, where one file covers a whole range of weights.
  • Always include fallbacks in font-family so the page still reads well if a font fails to load.

The easier way: choose fonts from a dropdown in Apollo Editor

Typing font-family rules into every stylesheet is fiddly. Apollo Editor supports web fonts and lets you apply them visually while it writes the CSS.

  • Pick fonts and sizes from the formatting toolbar while you edit in Design mode.
  • Set fonts, weights and colors for headings, body text and classes in the CSS Style Designer, with the result shown in the preview promptly.
  • Add a Google Fonts link in File > Page Properties as an external stylesheet or custom head markup, or keep self-hosted font files and @font-face rules in your site with site-wide CSS management.
  • Check how text looks at desktop, tablet and mobile sizes in Preview mode.

Self-hosted fonts work offline too, so you see the real typeface while you edit. Related guides: CSS basics for beginners, website accessibility basics and how to make a website responsive.

Frequently asked questions

Are Google Fonts free to use?

Google Fonts are released under open licenses that allow free use on websites, including commercial ones.

Should I host fonts myself?

Self-hosting avoids a request to another server, which can help speed and privacy. Many sites in Europe self-host for that reason.

How many fonts should a website use?

Usually one or two families, such as one for headings and one for body text, with only the weights you need.

Get three guides like this every month, plus software update notices.Subscribe →