How to Add Google Fonts to Your Website

Learn how to quickly add Google Fonts to your website with the HTML <link> element and a few lines of CSS.

This quick typography and CSS tutorial will show you the fastest way I know to add Google fonts to your website. If you don’t have a website to experiment with right now you can use this pen as your typography playground.

If you have a text editor on your local machine, create an index.html and add this HTML markup (it’s the same as the CodePen example):

<html lang="en">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
      Paragraph: Lorem ipsum dolor sit amet consectetur, adipisicing elit. Ipsam
      non modi odio, esse blanditiis omnis rerum ducimus fugit ea nihil
      accusantium molestiae doloremque dolorum magni laudantium autem nulla amet

Alright, we’re ready to add a font family (or typeface, it doesn’t matter what you call it on the web) to our glorious website.

Go to

On the front page, there is a list of popular fonts. You can also search for a specific font specimen if you already know what you’re looking for.

To make things simple, let’s pick the first font family on the front page, Roboto.

Click on the red + button in the top right corner.

On the bottom right side of your screen, you should see a little black bar pop up, saying 1 Family Selected.

Click on the bar to open the customization window.

Quick video:

Now under the Standard tab, copy the HTML link element that contains your Roboto font source:

<link href="" rel="stylesheet">

Paste the link element inside the <head> of your HTML document, so the head now looks like this:

  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />

Now in your CSS stylesheet, add the following CSS rule-set:

body {
  font-family: "Roboto", sans-serif;

Refer to the CodePen from earlier if you’re in doubt.

You’ve just added the Roboto font to your website!

Beware that by default you only add one of many font’s from a font family — the regular font-weight (numeric value: 400), also known as “roman style”.

If you want more weights and styles, go back to Google Fonts and click on the Customize tab, and select the other font variations you need. This will update your URL source link. Copy the new link and paste it inside your <link> element’s src.

If you chose Roboto Bold, and want to use bold to emphasize a part of your text, e.g. your headings, you would do it like this in CSS:

h6 {
  font-weight: 700;

Happy text formatting!

Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊


Share & Discuss on