Proper MIME type for OTF fonts
Since Feb 2017 RFC 8081 groups all MIME types for fonts under the top level font
media type. The older MIME types from my original posting are now listed as deprecated.
Font types as listed by IANA are now:
.otf ->
font/otf.sfnt ->
font/sfnt.ttf ->
font/ttf.woff ->
font/woff.woff2 ->
font/woff2
Other non-standard font formats are left as are:
.eot ->
application/vnd.ms-fontobject (as from December 2005).svg ->
image/svg+xml (as from August 2011)
[Outdated Original Post]
As there's still a lot of confusion on the web about MIME types for web fonts, I thought I'd give a current answer, complete with effective dates, and supporting links to IANA and the W3C.
Here are the official MIME types for Web Fonts:
.eot ->
application/vnd.ms-fontobject (as from December 2005).otf ->
application/font-sfnt (as from March 2013).svg ->
image/svg+xml (as from August 2011).ttf ->
application/font-sfnt (as from March 2013).woff ->
application/font-woff (as from January 2013).woff2 ->
font/woff2 (proposed by W3C in March 2016)
Note there is a movement to change all the above to MIME types of font/XXX
, as backed by the W3C in its proposal for WOFF v2. This is being tracked by the Internet Engineering Task Force (IETF) under The font Top Level Type and in February 2017 was approved RFC status (see RFC 8081) so it may all change yet!
While on the topic of web servers, it's worth mentioning that HTTP responses may gzip
(or otherwise compress) all the above font formats except .woff
& .woff2
which are already heavily compressed.
I say more in MIME Types for Web Fonts with (Fantom) BedSheet.
There are a number of font formats that one can set MIME types for, on both Apache and IIS servers. I've traditionally had luck with the following:
svg as "image/svg+xml" (W3C: August 2011)
ttf as "application/x-font-ttf" (IANA: March 2013)
or "application/x-font-truetype"
otf as "application/x-font-opentype" (IANA: March 2013)
woff as "application/font-woff" (IANA: January 2013)
woff2 as "application/font-woff2" (W3C W./E.Draft: May 2014/March 2016)
eot as "application/vnd.ms-fontobject" (IANA: December 2005)
sfnt as "application/font-sfnt" (IANA: March 2013)
According to the Internet Engineering Task Force who maintain the initial document regarding Multipurpose Internet Mail Extensions (MIME types) here: https://www.rfc-editor.org/rfc/rfc2045#section-5 ... it says in specifics:
"It is expected that additions to the larger set of supported types can generally be accomplished by the creation of new subtypes of these initial types. In the future, more top-level types may be defined only by a standards-track extension to this standard. If another top-level type is to be used for any reason, it must be given a name starting with "X-" to indicate its non-standard status and to avoid a potential conflict with a future official name."
As it were, and over time, additional MIME types get added as standards are created and accepted, therefor we see examples of vendor specific MIME types such as vnd.ms-fontobject and the like.
UPDATE August 16, 2013: WOFF was formally registered at IANA on January 3, 2013 and Webkit has been updated on March 5, 2013 and browsers that are sourcing this update in their latest versions will start issuing warnings about the server MIME types with the old x-font-woff declaration. Since the warnings are only annoying I would recommend switching to the approved MIME type right away. In an ideal world, the warnings will resolve themselves in time.
UPDATE February 26, 2015: WOFF2 is now in the W3C Editor's Draft with the proposed mime-type. It should likely be submitted to IANA in the next year (possibly by end of 2016) following more recent progress timelines. As well SFNT, the scalable/spline container font format used in the backbone table reference of Google Web Fonts with their sfntly java library and is already registered as a mime type with IANA and could be added to this list as well dependent on individual need.
UPDATE October 4, 2017: We can follow the progression of the WOFF2 format here with a majority of modern browsers supporting the format successfully. As well, we can follow the IETF's "font" Top-Level Media Type request for comments (RFC) tracker and document regarding the latest set of proposed font types for approval.
For those wishing to embed the typeface in the proper order in your CSS please visit this article. But again, I've had luck with the following order:
@font-face {
font-family: 'my-web-font';
src: url('webfont.eot');
src: url('webfont.eot?#iefix') format('embedded-opentype'),
url('webfont.woff2') format('woff2'),
url('webfont.woff') format('woff'),
url('webfont.ttf') format('truetype'),
url('webfont.svg#webfont') format('svg');
font-weight: normal;
font-style: normal;
}
For Subversion auto-properties, these can be listed as:
# Font formats
svg = svn:mime-type=image/svg+xml
ttf = svn:mime-type=application/x-font-ttf
otf = svn:mime-type=application/x-font-opentype
woff = svn:mime-type=application/font-woff
woff2 = svn:mime-type=application/font-woff2
eot = svn:mime-type=application/vnd.ms-fontobject
sfnt = svn:mime-type=application/font-sfnt
Try using "font/opentype".
Ignore the chrome warning. There is no standard MIME type for OTF fonts.
font/opentype may silence the warning, but that doesn't make it the "right" thing to do.
Arguably, you're better off making one up, e.g. with "application/x-opentype" because at least "application" is a registered content type, while "font" is not.
Update: OTF remains a problem, but WOFF grew an IANA MIME type of application/font-woff in January 2013.
Update 2: OTF has grown a MIME type: application/font-sfnt In March 2013. This type also applies to .ttf