TTF MIME Type – Free, Online, Private
font/ttf is the RFC 8081 type for a TrueType font. The scaler type at the start is 00 01 00 00 or the tag true.
What .ttf is
A TrueType font is a table directory. The first four bytes are the scaler type, either 00 01 00 00 or the tag true. A count of tables follows, then table records with checksums and offsets. Outline data lives in glyf, or in CFF for an OpenType font that is not TrueType. That second case is usually a .otf file and font/otf. RFC 8081 registers font/ttf and deprecates the application/x-font-ttf and application/x-font-truetype aliases. On the web you should be serving WOFF 2. font/ttf is the right type when you really are delivering the uncompressed TrueType file, for a download, a design tool, or an old client.
IANA registers font/ttf in RFC 8081. The media type is font/ttf. Extensions that use it on this page: .ttf. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.
What sends font/ttf
What sends font/ttf: Send font/ttf for a .ttf response. CORS still applies if a browser is going to use the file from an @font-face rule on another origin. For a website, package the font as WOFF 2 and send font/woff2 instead. Keep this type for the master download. Do not add a charset. A font license file next to the binary is text/plain or text/markdown, not font/ttf. Do not zip the two together and keep this type. A zip of a font is application/zip. The file on disk is still .ttf. Once the response exists, a client trusts font/ttf, not the filename. Subsetting changes the bytes. Change the URL when you subset, or a cache will keep the full font under a URL you now mean as a subset, or the reverse. The type stays font/ttf in both cases if you have not packaged WOFF 2.
Content-Type for .ttf
Send font/ttf and do not add a charset parameter. The body is binary. A charset tells a text decoder to reinterpret bytes that are not text, which corrupts a download and does not help a browser sniff the format.
Content-TypeContent-Type: font/ttf
nginx, Apache, and Express
These snippets map .ttf to font/ttf. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .ttf so a stale mime database in the framework cannot disagree with the type on this page.
nginx# /etc/nginx/mime.types, inside the types { } block
font/ttf ttf;
ApacheAddType font/ttf .ttf
Expressimport express from "express";
const app = express();
app.use(express.static("public", {
setHeaders(res, filePath) {
if (filePath.endsWith(".ttf")) {
res.setHeader("Content-Type", "font/ttf");
}
},
}));
Pitfalls for font/ttf
Pitfalls that show up for font/ttf, and not for a neighboring type with a similar extension: Serving a CFF OpenType font as font/ttf because the extension was wrong is a decoder error. Look at the scaler type. OTTO means OpenType with CFF, which is font/otf. Another bug is a collection, .ttc, served as font/ttf. A collection starts with ttcf and holds several fonts. Do not pretend it is one TrueType font. Another is a web font pipeline that outputs .ttf URLs with application/octet-stream and then wonders why nosniff blocks @font-face. Another is stripping tables to 'subset' and leaving a checksum mismatch. Browsers can reject the font. The type was never the problem.
- font/ttf is the registered type. application/x-font-ttf is an unofficial alias.
- Scaler type 00 01 00 00 or true is TrueType. OTTO is not, and ttcf is a collection.
- WOFF and WOFF 2 are different types even when they wrap this font.
- A license next to the file does not travel in the font response. Serve it separately if you need to show it.
Frequently asked questions
What type should a .ttf file use?
font/ttf. RFC 8081 deprecates the application/x-font-ttf alias.
What are the first bytes?
00 01 00 00, or the four characters true. OTTO is an OpenType CFF font, not this type.
Should a website serve TTF?
Prefer font/woff2 for pages. font/ttf is appropriate for a download of the original font.
Does @font-face accept this type?
Yes, if the header is font/ttf and, for a cross-origin font, CORS allows it. WOFF 2 is still the better delivery format.