Top view of someone holding an phone next to laptop

Web Design & Development Insights

How to add custom fonts to your Shopify store

Shopify is a popular e-commerce platform that provides users with a variety of customization options for their online store. One of these customization options is the ability to add custom fonts to your Shopify theme. By adding custom fonts, you can give your store a unique look and feel that sets it apart from other online stores. In this article, we will guide you through the process of adding custom fonts to your Shopify theme.

How to add custom fonts to your Shopify store

Before we begin, there are three ways to add custom fonts in Shopify.

  1. In the Theme Editor (depending on how the developer built your theme), you have a way to select a font from a long list of fonts that are built into Shopify itself. You can easily just select a font wherever the theme (or section) gives you the choice to do so. In most themes this lives under Theme settings > Typography.
  2. Use a font from font foundries like Google Fonts, Adobe Fonts and FontSquirrel.
  3. Manually install font files.

If the font you want is already in Shopify's built-in list, use option #1. It needs no code, and the theme handles loading the font for you. Let’s discuss option #2 and #3 in more detail.

Step 1: Choose a custom font (and check the license)

The first step in adding custom fonts to your Shopify theme is to choose the font you want to use. There are many sources for free and paid fonts on the web, including Google Fonts, Adobe Fonts, and FontSquirrel. When choosing a font, consider its readability, legibility, and how well it will match the style of your store. There are plenty of font families available that include different weights and styles and whether they are better to be used as headings versus body text.

Before you go any further, check how the font is licensed for websites, because it decides which of the steps below you're allowed to use:

  • Google Fonts are open source (most use the SIL Open Font License), so you can either link to them or download the files and host them yourself.
  • Adobe Fonts must be added with the embed code from your Adobe Fonts web project. Adobe doesn't allow you to download the files and upload them to your store.
  • Fonts you bought from a foundry often come with a desktop license only. A web license is usually a separate purchase, so read the license before uploading the files to your site.

Step 2: Paste a snippet linking the font from the foundry

In most cases, when selecting a font family from one of the foundries, you get a link that looks something like this (Adobe Fonts):

<link rel="stylesheet" href="https://use.typekit.net/vuh5cij.css">

or this (Google Fonts):

<link rel="preconnect" href="https://fonts.googleapis.com">

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500&display=swap" rel="stylesheet">

You will need to paste this at the top of every page of your site. With Shopify, this will be in the theme.liquid file located in the “layout” folder. To get there, go to Online Store > Themes in your Shopify admin, click the “...” button next to your theme and select “Edit code”. In theme.liquid, paste the code anywhere within the "head" tags. Just before the closing tag is a safe spot.

Only add the weights you actually use. In the Google Fonts example above, wght@400;500 loads two weights. Every extra weight or style is another file your visitors have to download. For other ways to keep your store quick, see our tips to optimize the speed of your Shopify website.

*** If your foundry provides you with the actual font files instead of a link as described, then you will need to take those files and upload them to either the “files” folder or to the “assets” folder.

If you get a choice of formats, use WOFF2. It's supported by every modern browser and it's about 30% smaller than the older WOFF format, and a lot smaller than TTF or OTF files. You don't need to upload TTF, EOT or SVG versions anymore. If you only have a TTF or OTF file, you can convert it to WOFF2, as long as the license allows it.

  • To upload the files to the “files” section in the admin, go to Content > Files in the Shopify admin and click “Upload files”. Once a file is uploaded, click the “Link” button next to it to copy its URL and save it for the next step. Note that on a trial store, Shopify only allows a short list of file types here (fonts are not on it), so use the “assets” folder instead until you're on a paid plan.
  • To upload the font files to the “assets” folder, go to “Online Store” and click on “Themes” on the left side bar of the Shopify admin. Then, choose the theme you’re working on (preferably not your live, published site - you should duplicate your live site when making any code changes so that mistakes don’t affect your live site). Click on the button with the three dots and select “Edit code”.

    Next, right-click the “assets” folder, select “Upload...” and choose your font files.

Step 3: Create a font-face rule

*** If you installing the files manually, then continue reading. Otherwise you can skip this step.

Now you will need to create a "font-face" rule. The font-face rule allows you to specify the location of the font file and give the font a name. To create a font-face rule, you can use the following code:

@font-face { font-family: 'Your Font Name'; src: url('font-file.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

Replace "Your Font Name" with the name of your font and "font-file.woff2" with the full path and filename of the font file. If you have more than one weight (regular and bold, for example), add one font-face rule per file, using the same font name and a different font-weight.

The font-display: swap; line tells the browser to show the text right away in a fallback font and switch to your font once it loads. Without it, some browsers hide the text for a moment while the font downloads.

  • If you uploaded the font to the “Files” folder, then you should replace “font-file.woff2” with the path you copied in the previous step. You can also use Shopify's file filter instead of pasting the full URL: {{ 'your-font-file.woff2' | file_url }}
  • If your font files were uploaded to the “Assets” folder, then you should replace “font-file.woff2” with the following code:
    {{ 'your-font-file.woff2' | asset_url }}

You may also see the font_url filter in your theme's code. That one is for the fonts in Shopify's built-in library (option #1 above), not for files you uploaded yourself, so stick with file_url or asset_url here.

Step 4: Add the font-face rule to your theme

Where you paste the font-face rule depends on how you wrote the path:

  • If you used asset_url or file_url, the rule has to go in a .liquid file, because Shopify only processes those double curly brace tags inside Liquid files. In a plain .css file they stay as text and the font never loads. Open theme.liquid in the “layout” folder and paste the rule inside a style tag, within the "head" tags: <style> ...your font-face rule... </style>
  • If you pasted the full URL you copied from Content > Files, you can put the rule in your theme's CSS file instead. Go to Online Store > Themes, click the "..." button next to your theme and select "Edit code". In the file explorer, open the “assets” folder and find the "theme.css" file. Once located, open the file and paste the font-face rule at the top of the file.
    Note: This file can be named differently, depending on your theme (Dawn, for example, uses base.css). But you should search for a CSS file with this file extension.

See our note at the end of this article if you’re trying to update your custom font on one of our Shopify sections.

Step 5: Apply the custom font

The final step is to apply the custom font to the elements of your website that you want to display in the new font. To do this, you will need to add some CSS code to your theme. In the same "theme.css" (or similar) file, add the following code:

body { font-family: 'Your Font Name', sans-serif; }

Replace "Your Font Name" with the name of the font you created in the font-face rule. This code sets the font-family property of the body element to your custom font.

Note: Typically, for foundries that provide you with a simple link (as opposed to actual font files), they should have provided you with this snippet of the font name already.

Many newer themes, including Dawn, set their fonts with CSS variables such as --font-body-family and --font-heading-family. Headings, buttons and menus read those variables, so a body rule alone may only change part of the page. If your theme works this way, search your theme files for those variable names and set them to your font instead.

My custom font isn't showing up. What should I check?

Most of the time it's one of these:

  • The name doesn't match. The name in font-family must be spelled exactly the same in the font-face rule and in the rule that applies it.
  • Liquid inside a .css file. If you used asset_url or file_url in theme.css, the path is broken. Move the rule to theme.liquid (see Step 4).
  • Wrong file path. Open your store, right-click and choose Inspect, then go to the Network tab and filter by “Font”. Reload the page. A font file with a 404 status means the path or file name is wrong.
  • The theme overrides it. In the same Inspect panel, click on a heading and look at the font-family in the Styles pane. If your rule is crossed out, a more specific rule in the theme is winning. Use the theme's font variables, or target the element more specifically.
  • You're editing the wrong theme. If you made the changes on a duplicate theme, preview that theme, not the live one.
  • The font isn't in your Adobe Fonts web project. Check the web project in your Adobe Fonts account and make sure the font (and the weights you use) were added to it.

Extra tip for those who have Abra Sections installed

In addition to providing the option to select a font from the built-in list in the Theme Editor, Abra Sections also provide you with a text field to paste the font-family rule as well. So you would simply take just the rule itself (i.e. font-family: 'Your Font Name', sans-serif;) and paste it in the field provided.

By following these steps, you can successfully add custom fonts to your Shopify theme and give your store a unique look and feel. Whether you want to use a more stylish font for your headings or a more readable font for your body text, custom fonts are a great way to make your store stand out.

Wondering what shape your own site is in?

Get a free 27-point Website Health Check - security, speed, accessibility and SEO. Plain English, no pitch.

Check my site

More to read

Image for 7 Must-Have Functionalities To Drive Sales In Your Shopify Store

7 Must-Have Functionalities To Drive Sales In Your Shopify Store

Shopify is a powerful e-commerce platform with a lot of valuable features and capabilities that makes selling online easier than you think.

Continue reading
Image for 10 Reasons Shopify Is The Best Solution For Your E-commerce Site

10 Reasons Shopify Is The Best Solution For Your E-commerce Site

Shopify is one of the most popular e-commerce platforms. It allows entrepreneurs all over the world to sell their products online. Recently, it’s become an industry leader with roughly 29% of the market share. Let’s see why businesses increasingly prefer Shopify to other e-commerce solutions.

Continue reading
Image for Design Trends in Beauty Industry Websites

Design Trends in Beauty Industry Websites

When running an online business, overlooking the significance of website design isn’t a good strategy.

Continue reading

Let's keep in touch

* We won't spam you or give your email to anyone.

Signup for Shopify Free Trial Try for Free