How to Load Only the Japanese Characters You Use with CSS unicode-range
A Japanese web font can be several MB in a single file. The IPA Gothic font I used for testing was about 3 MB as WOFF2. If you split the font into smaller files by character range and write each range in unicode-range in @font-face, the browser loads only the files that contain characters used on the page. This is useful when you want to serve a subset of the font and avoid loading characters that never appear on the page.
Test environment: Ubuntu 24.04, Node.js 22.23.4, Playwright 1.63.0, Chromium 153 (headless), fonttools 4.68.0. I used the IPA Gothic font installed in the test environment and served it from a test server. I did not test Firefox, Safari, or loading over a real network connection. Browser versions are from the compatibility data (@mdn/browser-compat-data 8.1.8).
- 1. unicode-range specifies the characters a file is responsible for
- 2. Split the font into files by character range
- 3. Only the files containing the characters used on the page were loaded
- 4. Writing only unicode-range without splitting the file loads the whole font
- 5. Characters that are not displayed, and characters added later
- 6. Google Fonts' Japanese font is split into even finer pieces
unicode-range specifies the characters a file is responsible for
unicode-range is a descriptor written inside @font-face. You write U+ followed by a hexadecimal code point, either as a single value (U+26), a range (U+3000-30FF), or a wildcard using ? (U+4??). You can list several separated by commas. If you omit it, the default is U+0-10FFFF, meaning all characters (unicode-range section of CSS Fonts 4).
If you write several @font-face rules with the same font-family name and different ranges, they are treated together as one font. For each character displayed, the browser loads only the file whose @font-face range includes that character. When ranges overlap, the browser checks @font-face rules starting from the one written last (composite fonts section of the spec).
According to the compatibility data, browser support starts at Chrome 1, Edge 12, Firefox 36, and Safari 3.1 (iOS Safari 3).
Split the font into files by character range
unicode-range does not make the file smaller by itself. You need to split the font file first.
Here I used pyftsubset from fonttools to split IPA Gothic into six WOFF2 files. For kanji, I divided the CJK Unified Ideographs range (U+4E00 to 9FFF) into four parts in code point order.
SRC=/usr/share/fonts/opentype/ipafont-gothic/ipag.ttf
pyftsubset "$SRC" --unicodes='*' --flavor=woff2 --layout-features='*' --output-file=full.woff2
pyftsubset "$SRC" --unicodes='U+0000-00FF' --flavor=woff2 --layout-features='*' --output-file=latin.woff2
pyftsubset "$SRC" --unicodes='U+3000-30FF,U+FF00-FFEF' --flavor=woff2 --layout-features='*' --output-file=kana.woff2
pyftsubset "$SRC" --unicodes='U+4E00-5FFF' --flavor=woff2 --layout-features='*' --output-file=kanji1.woff2
# Create kanji2 (U+6000-6FFF), kanji3 (U+7000-7FFF), and kanji4 (U+8000-9FFF) the same way
To write WOFF2 output, install brotli as well, for example with pip install fonttools brotli. The resulting file sizes are shown below.
| File | Range | Size |
|---|---|---|
full.woff2 (not split) |
all | 2,995,908 bytes |
latin.woff2 |
U+0000-00FF | 13,980 bytes |
kana.woff2 |
U+3000-30FF, U+FF00-FFEF | 36,208 bytes |
kanji1.woff2 |
U+4E00-5FFF | 535,532 bytes |
kanji2.woff2 |
U+6000-6FFF | 577,180 bytes |
kanji3.woff2 |
U+7000-7FFF | 593,316 bytes |
kanji4.woff2 |
U+8000-9FFF | 1,096,588 bytes |
kana.woff2 contains hiragana (for example U+3042), katakana (for example U+30A2), the ideographic comma (U+3001) and ideographic full stop (U+3002), and full-width alphanumerics (for example full-width A, U+FF21).
Only the files containing the characters used on the page were loaded
I placed the split files under the same font-family name.
@font-face {
font-family: "IPA Web";
src: url("/fonts/latin.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
@font-face {
font-family: "IPA Web";
src: url("/fonts/kana.woff2") format("woff2");
unicode-range: U+3000-30FF, U+FF00-FFEF;
}
@font-face {
font-family: "IPA Web";
src: url("/fonts/kanji1.woff2") format("woff2");
unicode-range: U+4E00-5FFF;
}
/* Write kanji2 to kanji4 the same way */
p {
font-family: "IPA Web", sans-serif;
}
I opened a page with a single paragraph and recorded the font requests that reached the server. To find which font actually drew each character, I used CSS.getPlatformFontsForNode from the Chrome DevTools Protocol.
| Characters in the paragraph | Files loaded | Total |
|---|---|---|
Hello, neko! |
latin.woff2 |
13,980 bytes |
| Hiragana: neko no te | kana.woff2 |
36,208 bytes |
| A 34-character sentence containing kanji | kana.woff2 and all four kanji files |
2,838,824 bytes |
In every case, all the characters in the paragraph were drawn with the web font. For a paragraph of English only, the kanji files were not loaded, and for a paragraph of kana only, the Latin file was not loaded either.
On the other hand, for the 34-character sentence meaning roughly "On a day busy enough that I would borrow even a cat's paw, I load the font only for the characters I need," all four kanji files were loaded. The kanji in this sentence fall into these ranges: U+501F, U+5FD9, U+5B57, and U+5206 are in kanji1; U+624B, U+65E5, and U+6587 are in kanji2; U+732B is in kanji3; U+8AAD and U+8FBC are in kanji4. Ten kanji were spread across all four ranges. Simply dividing kanji into large code-point blocks meant that even a short sentence loaded every kanji file, and the amount loaded was not much different from the unsplit case.

Writing only unicode-range without splitting the file loads the whole font
I wrote only unicode-range: U+3000-30FF; on the unsplit full.woff2 and displayed the three code points U+732B (cat), U+306E (no), and U+624B (hand).
@font-face {
font-family: "IPA Web";
src: url("/fonts/full.woff2") format("woff2");
unicode-range: U+3000-30FF;
}
Because U+306E is in the range, all 2,995,908 bytes of full.woff2 were loaded. U+306E was drawn with the web font, while U+732B and U+624B, which are outside the range, were drawn with a font installed on the device. The split kanji3.woff2 could draw U+732B with the web font, so the glyph exists in that file. Even so, because it was outside the range, it was not used.
The unicode-range section of the spec also says the font is not used for characters outside the range. As MDN's unicode-range description explains, if even one character in the range appears on the page, the whole file is downloaded.
Characters that are not displayed, and characters added later
For characters that appear only in an element with display: none, the file for that range was not loaded. For characters in an element with visibility: hidden, it was loaded. As MDN's visibility description explains, an element with visibility: hidden still affects layout even though it is invisible.
I opened a page whose paragraph contained only Hello, and then added U+732B (cat) with JavaScript. Right after opening, only latin.woff2 was loaded. After U+732B was added, kanji3.woff2 was loaded, and U+732B was drawn with the web font.
When I checked the state of each @font-face with document.fonts, only the loaded ones were loaded, and the others stayed unloaded. The output below lists "range=state" pairs separated by commas. U+3000-30FF, U+FF00-FFEF=unloaded is a single entry for kana.woff2, which has two ranges.
開いた直後: U+0-FF=loaded, U+3000-30FF, U+FF00-FFEF=unloaded, U+4E00-5FFF=unloaded, U+6000-6FFF=unloaded, U+7000-7FFF=unloaded, U+8000-9FFF=unloaded
「猫」を足したあと: U+0-FF=loaded, U+3000-30FF, U+FF00-FFEF=unloaded, U+4E00-5FFF=unloaded, U+6000-6FFF=unloaded, U+7000-7FFF=loaded, U+8000-9FFF=unloaded
In unicodeRange from document.fonts, the U+0000-00FF written in CSS was returned as U+0-FF, with the leading zeros dropped. The spec also allows browsers to rewrite a range into another notation for the same set of characters.
Google Fonts' Japanese font is split into even finer pieces
For comparison, I loaded the Google Fonts CSS for Noto Sans JP without specifying a weight, using Chromium in the test environment (retrieved on November 8, 2026).
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap">
The returned CSS contained 124 @font-face rules. The first unicode-range is not one continuous range; it lists 211 scattered code points such as U+25ee8, U+25f23, U+25f5c, …. The 124th covers Latin ranges including U+0000-00FF.
When I displayed the same 34-character sentence, the kanji in the sentence were spread across nine @font-face rules, and the kana and the ideographic comma and full stop were all in the 120th. Eleven WOFF2 files were loaded, totaling 144,264 bytes. Those 11 files include the 124th file, which contains none of the characters in the sentence. For neko no te alone, the 120th and 124th files (55,756 bytes in total) were loaded.
Since the fonts are different, the file sizes cannot be compared directly with the IPA Gothic results. However, for this sentence only 11 of the 124 files were loaded. This does not match the IPA Gothic case, where dividing by code point into six files meant almost all files were loaded.
unicode-range only declares which characters a file is responsible for. It reduces the amount loaded only when the font files themselves are split.





