font/woff2 means: font/woff2 is the registered media type for Web Open Font Format 2.0, which uses Brotli compression to achieve roughly 30% smaller files than WOFF 1.0. WOFF2 is the recommended web font format today, supported by all modern browsers for efficient @font-face delivery. Font media types identify web font files served to browsers via @font-face. The subtype maps to a font container format, and the correct type lets browsers validate and cache fonts efficiently. Modern web delivery favors compressed WOFF2; serving fonts with a generic or wrong type can trigger download failures or CORS-related blocking. You will encounter font/woff2 in contexts such as primary web font format in @font-face; performance-optimized font delivery; subsetted fonts for minimal payload. It is commonly associated with the file extension(s) .woff2. Always serve WOFF2 with font/woff2 and immutable cache headers for fingerprinted files. Subset fonts to the glyphs you use (e.g. latin) to shrink them further, and add Access-Control-Allow-Origin when fonts are hosted on a CDN or another domain.
When you'll see font/woff2
- Primary web font format in @font-face
- Performance-optimized font delivery
- Subsetted fonts for minimal payload
How to handle it
When serving web fonts, use WOFF2 for the smallest payload, set immutable cache headers, and add Access-Control-Allow-Origin when fonts are cross-origin. Reference them in @font-face with the correct format() hint and a font-display strategy (swap or optional) to control flash of invisible text. Subset fonts to the glyphs you actually use to cut download size further. As a final checklist for font types: prefer WOFF2, subset to used glyphs, set immutable caching and cross-origin CORS headers, choose a font-display strategy to avoid invisible text, and preload the critical fonts so first paint is not delayed by late font downloads.
Notes & gotchas
Always serve WOFF2 with font/woff2 and immutable cache headers for fingerprinted files. Subset fonts to the glyphs you use (e.g. latin) to shrink them further, and add Access-Control-Allow-Origin when fonts are hosted on a CDN or another domain.
Examples
HTTP/1.1 200 OK
Content-Type: font/woff2
Content-Disposition: inline; filename="sample.woff2"
[binary font payload: the encoded bytes of a sample .woff2] curl -i -H "Accept: font/woff2" https://api.example.com/v1/resource # inspect the returned Content-Type const res = await fetch("/v1/resource", { headers: { Accept: "font/woff2" } });
// verify res.headers.get("Content-Type") starts with "font/woff2"
const text = await res.text(); // handle according to the declared type import requests
res = requests.get("https://api.example.com/v1/resource",
headers={"Accept": "font/woff2"}, timeout=30)
res.raise_for_status()
assert res.headers["Content-Type"].startswith("font/woff2")
with open("sample.woff2", "wb") as fh:
fh.write(res.content) # raw bytes; use stream=True for large files Frequently asked questions
Is WOFF2 supported everywhere?
All modern browsers support WOFF2; only very old clients need a WOFF fallback. It is the best default for web fonts due to superior Brotli compression.
How do I reduce WOFF2 file size further?
Subset the font to only the characters and Unicode ranges you need, and remove unused glyphs and hinting. Tools like fonttools or glyphhanger produce small subsetted WOFF2 files.
Which font MIME type should I use for @font-face?
font/woff2 for modern compressed fonts (best compression, universal support), font/woff as a fallback. Older font/ttf and font/otf work but are larger. Always serve fonts with correct CORS headers when hosted on another origin.
Why do my web fonts 404 or get blocked?
Usually a wrong path, a missing CORS header on cross-origin font hosts, or an incorrect MIME type. Verify the server returns font/woff2 with Access-Control-Allow-Origin when the font lives on a CDN or another domain.
How do I avoid invisible text while fonts load?
Use font-display: swap (or optional) in @font-face so fallback text shows immediately, and preload critical WOFF2 files. This prevents the flash of invisible text that hurts perceived performance.
Try the Base64 Encoder
Encode and decode Base64 with UTF-8 and URL-safe options.