132

What are people using as the length of a MIME type field in their databases? The longest one we've seen so far is 72 bytes:

application/vnd.openxmlformats-officedocument.wordprocessingml.document

But I'm just waiting for a longer one. We're using 250 now, but has anyone seen a longer MIMEType than that?


Edit

From the accepted answer, 127 for type and sub-type each, so that's 254 max, plus the '/' is a limit of 255 for the combined value.

1 Answer 1

202

According to RFC 4288 "Media Type Specifications and Registration Procedures", type (eg. "application") and subtype (eg "vnd...") both can be max 127 characters. So including the slash, the maximum length is 255.

Edit: Meanwhile, that document has been obsoleted by RFC 6838, which does not alter the maximum size but adds a remark:

Also note that while this syntax allows names of up to 127 characters, implementation limits may make such long names problematic. For this reason, <type-name> and <subtype-name> SHOULD be limited to 64 characters.

7
  • 1
    Damn, I'd searched for that and never could find a good reference. Commented Mar 13, 2009 at 20:04
  • 156
    For those who are not good at maths, that makes 127+1+127 = 255 if you include the slash. Commented Feb 10, 2012 at 10:34
  • 2
    Has anyone an example of a mime type that goes over 127 chars? I doubt there are much? At least I've never seen one and I don't think they're good in any way.
    – floriank
    Commented Mar 2, 2016 at 8:57
  • 17
    Math is not for programmers.
    – SeanCannon
    Commented Apr 6, 2018 at 16:06
  • 8
    Today's longest entry in iana.org/assignments/media-types/media-types.xhtml is application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml (plus 2 more of the same length), which makes 11 + 1 + 72 (more than the suggested 64 subtype chars) = 84 chars.
    – ax.
    Commented Feb 25, 2021 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.