Course contentsShow
← Web Development
Lesson 565 of 2,98210. Typography and Design SystemsFree lesson

Unicode Ranges and Subsetting

Use the unicode-range descriptor to load only the characters you need, reducing file sizes.

Unicode Ranges and Subsetting

You'll learn how to load only the specific characters you need from a web font, dramatically reducing file sizes and improving page load times.

What's the Problem?

When you load a web font, it typically contains thousands of characters—uppercase, lowercase, numbers, punctuation, accented characters, symbols, and more. If your website only uses English text, you're downloading characters for Cyrillic, Greek, Vietnamese, and dozens of other scripts you'll never display. That's wasted bandwidth.

The Solution: Unicode Subsetting

The unicode-range descriptor inside @font-face tells the browser: "Only download this font file if the page actually contains these specific characters."

Think of it like ordering a pizza. Instead of buying a whole pizza when you only want two slices, you tell the pizzeria exactly which slices you need. Your browser becomes smarter about what to download.

How It Works

@font-face {
  font-family: 'MyFont';
  src: url('myfont-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153;
}

The U+ notation specifies character ranges. U+0000-00FF covers basic Latin characters (English alphabet, common punctuation). If your page contains only these characters, only this font file loads.

You can create multiple @font-face rules for the same font-family, each targeting different character sets with different font files.

Real-World Benefits

A full font might be 200KB. A Latin-only subset could be 20KB—a 90% reduction. Multiply that across multiple font weights and styles, and you've saved significant load time, especially on mobile connections.

Key Takeaway: Use the unicode-range descriptor to subset fonts by character range, loading only what your content actually needs and dramatically reducing file sizes.