Skip to content

font/ttf MIME Type — Meaning, Usage & Examples

font/ttf
Extensions: .ttf Class: font Spec: RFC 8081 (IANA registered)
View IANA registration ↗

font/ttf means: font/ttf is the registered media type for TrueType Font files, an outline font standard developed by Apple and Microsoft. TTF stores glyph outlines and hinting instructions; on the web it is usually converted to WOFF/WOFF2 for compression, but raw TTF is still served in some cases. 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/ttf in contexts such as desktop and application font installation; source fonts before web compression; legacy @font-face delivery without woff. It is commonly associated with the file extension(s) .ttf. Raw TTF is larger than WOFF2 because it is uncompressed. For web delivery convert TTF to WOFF2 (and WOFF fallback) to cut bandwidth. The older application/x-font-ttf and font/sfnt aliases exist; font/ttf is the registered form per RFC 8081.

Advertisement
Ad slot · ref-top

When you'll see font/ttf

  • Desktop and application font installation
  • Source fonts before web compression
  • Legacy @font-face delivery without WOFF

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

Raw TTF is larger than WOFF2 because it is uncompressed. For web delivery convert TTF to WOFF2 (and WOFF fallback) to cut bandwidth. The older application/x-font-ttf and font/sfnt aliases exist; font/ttf is the registered form per RFC 8081.

Examples

HTTP
HTTP/1.1 200 OK
Content-Type: font/ttf
Content-Disposition: inline; filename="sample.ttf"

[binary font payload: the encoded bytes of a sample .ttf]
curl
curl -i -H "Accept: font/ttf" https://api.example.com/v1/resource   # inspect the returned Content-Type
JavaScript (fetch)
const res = await fetch("/v1/resource", { headers: { Accept: "font/ttf" } });
// verify res.headers.get("Content-Type") starts with "font/ttf"
const text = await res.text();   // handle according to the declared type
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource",
                   headers={"Accept": "font/ttf"}, timeout=30)
res.raise_for_status()
assert res.headers["Content-Type"].startswith("font/ttf")
with open("sample.ttf", "wb") as fh:
    fh.write(res.content)   # raw bytes; use stream=True for large files

Frequently asked questions

Should I serve TTF directly on the web?

Prefer converting to WOFF2 for compression; TTF works but wastes bandwidth. Keep TTF as the source and generate WOFF2/WOFF for @font-face.

What is the difference between TTF and OTF?

TrueType (TTF) uses quadratic Bezier outlines; OpenType (OTF) can use either TrueType or CFF/PostScript outlines and supports advanced typographic features. Both are wrapped by WOFF/WOFF2 for the web.

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.

Advertisement
Ad slot · ref-in-article

Try the Base64 Encoder

Encode and decode Base64 with UTF-8 and URL-safe options.

Open tool →