CSS unicode-range Property
The CSS unicode-range descriptor specifies which Unicode characters a font defined by an @font-face rule is intended to support.
It allows browsers to select and download font resources based on the characters used in a document. This is particularly useful when dividing large fonts into smaller subsets for different languages or writing systems.
Important: Although commonly included in CSS property references, unicode-range is technically an @font-face descriptor, not a regular CSS property. It must be declared inside an @font-face rule and cannot be applied directly to an HTML element.
unicode-range Syntax
The unicode-range descriptor accepts one or more Unicode ranges. Each range begins with U+ followed by hexadecimal digits, an optional ending code point, or wildcard characters.
Basic Syntax
@font-face {
font-family: "Example Font";
src: url("example-font.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
Single Code Point
@font-face {
font-family: "Example Font";
src: url("example-font.woff2") format("woff2");
unicode-range: U+0041;
}
This specifies Unicode code point U+0041, which represents the uppercase Latin letter A.
Code Point Range
@font-face {
font-family: "Example Font";
src: url("example-font.woff2") format("woff2");
unicode-range: U+0041-005A;
}
This covers uppercase Latin letters A through Z.
Wildcard Range
@font-face {
font-family: "Example Font";
src: url("example-font.woff2") format("woff2");
unicode-range: U+4??;
}
This covers code points from U+0400 through U+04FF.
Multiple Ranges
@font-face {
font-family: "Example Font";
src: url("example-font.woff2") format("woff2");
unicode-range: U+0041-005A, U+0061-007A, U+0030-0039;
}
This covers uppercase Latin letters, lowercase Latin letters, and decimal digits.
Default Behavior
@font-face {
font-family: "Example Font";
src: url("example-font.woff2") format("woff2");
}
When unicode-range is omitted, its default value covers all valid Unicode code points.
Invalid Examples
@font-face {
font-family: "Example Font";
src: url("example-font.woff2");
unicode-range: 0041-005A;
}
@font-face {
font-family: "Example Font";
src: url("example-font.woff2");
unicode-range: U+005A-0041;
}
@font-face {
font-family: "Example Font";
src: url("example-font.woff2");
unicode-range: U+110000;
}
The first example is missing the required U+ prefix. The second has a starting code point greater than the ending code point. The third exceeds the maximum Unicode code point, U+10FFFF.
Descriptor Values
| Value | Description |
|---|---|
U+<hex> |
Specifies a single Unicode code point. |
U+<hex>-<hex> |
Specifies an inclusive range of Unicode code points. |
U+<hex-or-?> |
Specifies a wildcard range using one or more trailing question marks. |
<range>, <range> |
Specifies multiple Unicode ranges separated by commas. |
Descriptor Characteristics
| Characteristic | Value |
|---|---|
| Descriptor type | @font-face descriptor |
| Initial value | U+0-10FFFF |
| Inherited | Not applicable |
| Applies to | Font faces defined by @font-face |
| Computed value | Not applicable as an ordinary CSS property |
| Animation type | Not animatable |
| Percentages | Not applicable |
| Specification | CSS Fonts Module Level 4 |
Note: The descriptor does not add characters to a font file. It only declares which Unicode code points the font face should be considered for during font selection.
How It Works
When a page uses a web font, the browser must determine which font face can provide each character.
The unicode-range descriptor helps the browser decide which font resources are relevant to the text being displayed.
Step 1: Define a Font Face
@font-face {
font-family: "Site Font";
src: url("site-font-latin.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
Step 2: Apply the Font Family
body {
font-family: "Site Font", Arial, sans-serif;
}
Step 3: Match Characters
When the browser encounters text, it checks the declared Unicode ranges while selecting an appropriate font face.
Step 4: Load the Required Font
If a character falls within a matching range, the browser may request the associated font resource when that font face is needed.
Step 5: Render the Text
The browser uses the selected font when the required glyph is available. Otherwise, font fallback may be necessary.
Important Distinction
The descriptor limits font-face eligibility. It does not guarantee that the font file contains every character listed in its Unicode range.
Single Unicode Code Point
A single Unicode code point identifies one character or other Unicode code point value.
Uppercase Letter A
@font-face {
font-family: "Letter Font";
src: url("letter-font.woff2") format("woff2");
unicode-range: U+0041;
}
Digit Zero
@font-face {
font-family: "Digit Font";
src: url("digit-font.woff2") format("woff2");
unicode-range: U+0030;
}
Euro Sign
@font-face {
font-family: "Symbol Font";
src: url("symbol-font.woff2") format("woff2");
unicode-range: U+20AC;
}
When to Use It
Single-code-point declarations are useful when a specialized font contains a particular symbol or a very small collection of characters.
Important Consideration
Many visible symbols, including some emoji, can involve multiple Unicode code points. A single-code-point range may not cover an entire character sequence.
Unicode Code Point Range
A Unicode range includes all code points between its starting and ending values, including both endpoints.
Uppercase Latin Letters
@font-face {
font-family: "Uppercase Font";
src: url("uppercase.woff2") format("woff2");
unicode-range: U+0041-005A;
}
Lowercase Latin Letters
@font-face {
font-family: "Lowercase Font";
src: url("lowercase.woff2") format("woff2");
unicode-range: U+0061-007A;
}
Decimal Digits
@font-face {
font-family: "Number Font";
src: url("numbers.woff2") format("woff2");
unicode-range: U+0030-0039;
}
Basic Latin Block
@font-face {
font-family: "Basic Latin Font";
src: url("basic-latin.woff2") format("woff2");
unicode-range: U+0000-007F;
}
Latin-1 Supplement Block
@font-face {
font-family: "Latin Supplement Font";
src: url("latin-supplement.woff2") format("woff2");
unicode-range: U+0080-00FF;
}
Important Consideration
A Unicode block is a defined collection of code points. A font may support only some characters within that block, so its declared range should reflect the actual font coverage.
Wildcard Ranges
The question mark character can replace one or more trailing hexadecimal digits in a Unicode range.
One Wildcard
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
unicode-range: U+00A?;
}
This covers code points U+00A0 through U+00AF.
Two Wildcards
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
unicode-range: U+4??;
}
This covers U+0400 through U+04FF.
Three Wildcards
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
unicode-range: U+1F???;
}
This covers U+1F000 through U+1FFFF.
Invalid Wildcard Placement
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
unicode-range: U+4?0;
}
Wildcards must appear at the end of the hexadecimal sequence.
When to Use Wildcards
Wildcards provide a compact way to describe ranges that share a common hexadecimal prefix.
Important Consideration
Wildcard ranges can include more characters than intended. Check the resulting range before using it to describe a font subset.
Multiple Unicode Ranges
A single unicode-range declaration can contain multiple ranges separated by commas.
Uppercase and Lowercase Letters
@font-face {
font-family: "Letter Font";
src: url("letters.woff2") format("woff2");
unicode-range: U+0041-005A, U+0061-007A;
}
Letters and Numbers
@font-face {
font-family: "Text Font";
src: url("text.woff2") format("woff2");
unicode-range: U+0030-0039, U+0041-005A, U+0061-007A;
}
Latin and Greek
@font-face {
font-family: "Multilingual Font";
src: url("multilingual.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0370-03FF;
}
Mixing Ranges and Wildcards
@font-face {
font-family: "Mixed Font";
src: url("mixed.woff2") format("woff2");
unicode-range: U+0041-005A, U+0061-007A, U+4??;
}
Important Consideration
Overlapping ranges are permitted. The browser treats the descriptor as the union of the specified code points.
Font Subsetting
Font subsetting divides a large font into smaller files containing selected characters.
When used with accurately declared Unicode ranges, subsets can reduce the amount of font data downloaded for pages that use only certain scripts.
Latin Font Subset
@font-face {
font-family: "Global Font";
src: url("global-latin.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
Greek Font Subset
@font-face {
font-family: "Global Font";
src: url("global-greek.woff2") format("woff2");
unicode-range: U+0370-03FF;
}
Cyrillic Font Subset
@font-face {
font-family: "Global Font";
src: url("global-cyrillic.woff2") format("woff2");
unicode-range: U+0400-04FF;
}
Apply the Font Family
body {
font-family: "Global Font", sans-serif;
}
How It Works
All three font faces share the same family name. The browser can select the appropriate subset based on the Unicode characters required by the text.
Important Consideration
Declaring separate ranges does not physically split a font file. You must create or obtain the corresponding subset files before referencing them.
Font Loading Behavior
The unicode-range descriptor influences whether a font face is relevant to the characters on a page.
Latin Characters
@font-face {
font-family: "Example Font";
src: url("latin.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
Greek Characters
@font-face {
font-family: "Example Font";
src: url("greek.woff2") format("woff2");
unicode-range: U+0370-03FF;
}
Font Selection
If a page contains only characters covered by the Latin subset, the browser generally does not need the Greek subset for that text.
Loading Additional Characters
If Greek text is later added to the page, the browser may request the Greek subset when that font face becomes necessary.
Using font-display
@font-face {
font-family: "Example Font";
src: url("latin.woff2") format("woff2");
font-display: swap;
unicode-range: U+0000-00FF;
}
The font-display descriptor controls how text is displayed while the font loads. It serves a different purpose from unicode-range.
Important Consideration
Actual font requests depend on font selection, character usage, caching, browser behavior, and other loading conditions. The descriptor does not guarantee a specific number of network requests.
Font Fallback
Font fallback occurs when the selected font cannot provide a glyph needed to display a character.
Define a Limited Font Face
@font-face {
font-family: "Limited Font";
src: url("limited-latin.woff2") format("woff2");
unicode-range: U+0000-007F;
}
Provide Fallback Fonts
body {
font-family: "Limited Font", Arial, sans-serif;
}
Mixed-Language Text
<p>Hello - مرحبا</p>
The browser can use the custom font for eligible Latin characters and another font for Arabic characters when necessary.
Missing Glyphs
Even when a code point is included in the declared range, the font file may not contain a usable glyph for it.
Important Consideration
Always provide suitable fallback fonts, particularly for multilingual websites and interfaces containing special symbols.
Related CSS Descriptors and Properties
@font-face
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
}
Defines a downloadable font face and its associated descriptors.
font-family Descriptor
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
}
Names the font family defined by an @font-face rule.
src Descriptor
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
}
Specifies the location and format of a font resource.
font-display Descriptor
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
font-display: swap;
}
Controls font display behavior during loading.
font-weight Descriptor
@font-face {
font-family: "Example Font";
src: url("example-bold.woff2") format("woff2");
font-weight: 700;
}
Describes the weight supported by the font face.
font-style Descriptor
@font-face {
font-family: "Example Font";
src: url("example-italic.woff2") format("woff2");
font-style: italic;
}
Describes the style supported by the font face.
font-family Property
body {
font-family: "Example Font", sans-serif;
}
Selects a font family for text displayed in an element.
Complete Example
@font-face {
font-family: "Site Font";
src: url("site-font-latin.woff2") format("woff2");
font-style: normal;
font-weight: 400;
font-display: swap;
unicode-range: U+0000-00FF;
}
body {
font-family: "Site Font", Arial, sans-serif;
}
Inheritance and Application
The unicode-range descriptor is not inherited because it is not applied to individual HTML elements.
Correct Usage
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
Incorrect Usage
p {
unicode-range: U+0000-00FF;
}
The descriptor has no effect when declared in a normal element style rule.
Using the Font Family
p {
font-family: "Example Font", sans-serif;
}
The font-family property can be inherited by child elements, but the Unicode range remains associated with the font face definition.
CSS-Wide Keywords
CSS-wide keywords such as inherit, initial, and unset are not used as ordinary inherited property values for this descriptor.
Default Value
When the descriptor is omitted, its default range is U+0-10FFFF, covering all valid Unicode code points for font-face selection.
Practical Examples
Basic Latin Subset
@font-face {
font-family: "Site Font";
src: url("site-latin.woff2") format("woff2");
unicode-range: U+0000-007F;
}
Latin-1 Supplement
@font-face {
font-family: "Site Font";
src: url("site-latin-ext.woff2") format("woff2");
unicode-range: U+0080-00FF;
}
Greek Subset
@font-face {
font-family: "Site Font";
src: url("site-greek.woff2") format("woff2");
unicode-range: U+0370-03FF;
}
Cyrillic Subset
@font-face {
font-family: "Site Font";
src: url("site-cyrillic.woff2") format("woff2");
unicode-range: U+0400-04FF;
}
Arabic Subset
@font-face {
font-family: "Site Font";
src: url("site-arabic.woff2") format("woff2");
unicode-range: U+0600-06FF;
}
Hebrew Subset
@font-face {
font-family: "Site Font";
src: url("site-hebrew.woff2") format("woff2");
unicode-range: U+0590-05FF;
}
Selected Symbols
@font-face {
font-family: "Symbol Font";
src: url("symbols.woff2") format("woff2");
unicode-range: U+2600-26FF;
}
Numbers Only
@font-face {
font-family: "Number Font";
src: url("numbers.woff2") format("woff2");
unicode-range: U+0030-0039;
}
Each example assumes that the referenced font file contains the appropriate glyphs. The declared range alone does not create the subset.
unicode-range Example
This example demonstrates how separate font faces can share a family name while covering different Unicode ranges.
The example uses local font families so it can be tested without downloading external files. In a production website, the font sources would normally reference actual subset files.
HTML Example
<div class="unicode-demo">
<p class="unicode-latin">Hello World 123</p>
<p class="unicode-greek">Αλφάβητο</p>
<p class="unicode-cyrillic">Привет мир</p>
</div>
CSS Example
@font-face {
font-family: "Unicode Demo";
src: local("Arial");
unicode-range: U+0000-00FF;
}
@font-face {
font-family: "Unicode Demo";
src: local("Arial");
unicode-range: U+0370-03FF;
}
@font-face {
font-family: "Unicode Demo";
src: local("Arial");
unicode-range: U+0400-04FF;
}
.unicode-demo {
padding: 15px;
border: 1px solid #d1d5db;
border-radius: 4px;
}
.unicode-demo p {
font-family: "Unicode Demo", Arial, sans-serif;
font-size: 20px;
margin: 0 0 12px;
}
.unicode-demo p:last-child {
margin-bottom: 0;
}
Hello World 123
Αλφάβητο
Привет мир
Understanding the Results
The three font-face declarations use the same family name but define different Unicode ranges.
Latin Text
The English letters and numbers fall within the Latin range.
Greek Text
The Greek characters fall within the Greek range.
Cyrillic Text
The Cyrillic characters fall within the Cyrillic range.
Local Font Availability
The visual result depends on whether Arial is available and whether the selected font contains the required glyphs. The browser may use fallback fonts when necessary.
Using Actual Font Subsets
Replace the local font sources with real font files when implementing this technique on a website.
@font-face {
font-family: "Unicode Demo";
src: url("unicode-latin.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
@font-face {
font-family: "Unicode Demo";
src: url("unicode-greek.woff2") format("woff2");
unicode-range: U+0370-03FF;
}
@font-face {
font-family: "Unicode Demo";
src: url("unicode-cyrillic.woff2") format("woff2");
unicode-range: U+0400-04FF;
}
Each file should contain the characters declared by its corresponding Unicode range.
Accessibility Considerations
Correct font coverage helps ensure that text remains readable across different languages, scripts, and devices.
Provide Appropriate Font Fallbacks
body {
font-family: "Site Font", Arial, sans-serif;
}
Fallback fonts allow the browser to display characters that the custom font does not support.
Avoid Missing Glyphs
Verify that each font subset contains the glyphs required by its declared Unicode range.
Preserve Actual Text Characters
Do not replace meaningful text with decorative font glyph mappings when standard Unicode characters are available.
Support Multilingual Content
Test all languages and writing systems used on the website, including punctuation, numbers, and accented characters.
Use Appropriate Language Attributes
<p lang="el">Αλφάβητο</p>
<p lang="ru">Привет мир</p>
The HTML lang attribute identifies the language independently of the font's Unicode coverage.
Avoid Layout Instability
Font loading can change text measurements. Choose suitable fallback fonts and test layout behavior while web fonts load.
Test Assistive Technologies
Screen readers rely on the document's text and language information, not the unicode-range descriptor, to interpret content.
Common Mistakes
Using unicode-range Outside @font-face
p {
unicode-range: U+0000-00FF;
}
The descriptor must appear inside an @font-face rule.
Omitting the U+ Prefix
@font-face {
font-family: "Example Font";
src: url("example.woff2");
unicode-range: 0041-005A;
}
Each Unicode range must begin with U+.
Reversing Range Endpoints
@font-face {
font-family: "Example Font";
src: url("example.woff2");
unicode-range: U+005A-0041;
}
The starting code point must not be greater than the ending code point.
Exceeding the Unicode Limit
@font-face {
font-family: "Example Font";
src: url("example.woff2");
unicode-range: U+110000;
}
The highest valid Unicode code point is U+10FFFF.
Using Wildcards in the Middle
@font-face {
font-family: "Example Font";
src: url("example.woff2");
unicode-range: U+4?0;
}
Wildcard question marks must appear at the end of the code point pattern.
Assuming unicode-range Creates Font Subsets
The descriptor does not modify the referenced font file. Subset files must be created separately.
Declaring Characters Missing From the Font
Including a code point in the descriptor does not guarantee that the font contains a glyph for it.
Forgetting Font Fallbacks
Provide fallback fonts for characters not covered by the custom font.
Confusing Unicode Coverage With Language Detection
The descriptor identifies code points, not languages. Multiple languages can share the same Unicode characters.
Using Overly Broad Ranges
Broad ranges may cause unnecessary font resources to be considered during font selection, reducing the benefits of subsetting.
Important Considerations
Keep the following points in mind when using unicode-range:
unicode-rangeis an@font-facedescriptor, not a regular CSS property.- It must be declared inside an
@font-facerule. - It specifies Unicode code points for font-face selection.
- The default value is
U+0-10FFFF. - Each range begins with
U+. - Unicode code points are written using hexadecimal digits.
- A single code point can be specified.
- An inclusive range can be specified with a hyphen.
- Wildcard question marks can represent trailing hexadecimal digits.
- Multiple ranges are separated by commas.
- Overlapping ranges are permitted.
- The maximum Unicode code point is U+10FFFF.
- The descriptor does not create or modify font files.
- Font subsets must be generated separately.
- Declared ranges should match the actual character coverage of the font files.
- Multiple font faces can share the same family name.
- Different font faces can cover different Unicode ranges.
- The browser selects font faces based on the characters required by the text.
- Font fallback may occur when a required glyph is unavailable.
- The descriptor can help reduce unnecessary font downloads.
- The
font-displaydescriptor controls font loading display behavior separately. - The descriptor is not inherited.
- The descriptor is not animatable.
- It does not identify the language of text.
- It does not alter the document's Unicode characters.
- Test multilingual content and fallback behavior.
- Check actual font requests using browser developer tools.
Browser Support
The CSS unicode-range descriptor is widely supported in modern browsers, including current versions of Chrome, Edge, Firefox, and Safari.
Older browsers may have limitations in how they process Unicode ranges and select downloadable font resources.
For current compatibility information, visit Can I Use? and search for unicode-range.
Basic Declaration
@font-face {
font-family: "Example Font";
src: url("example.woff2") format("woff2");
unicode-range: U+0000-00FF;
}
Fallback Fonts
body {
font-family: "Example Font", Arial, sans-serif;
}
Testing Recommendations
Use browser developer tools to inspect font requests and verify that the expected subset files are loaded for the characters displayed on the page.
Test font fallback, mixed-language content, and character coverage in all browsers you intend to support.
Specifications
The unicode-range descriptor is defined in the CSS Fonts Module specification.
CSS Fonts Module Level 4 - The unicode-range Descriptor
The specification defines the syntax and behavior of Unicode ranges used in downloadable font-face declarations.
For additional documentation and examples, consult MDN Web Docs.
