Testing file uploads or a content-type allow-list? This generator hands you random, valid IANA media types — optionally filtered to one category — along with a typical file extension for each.
How it works
An IANA media type takes the form type/subtype. The top-level type is one of a
small set of categories (text, image, audio, video, application), and
the subtype names the specific format. This tool keeps a table of registered
types and samples from it:
filter the table to the chosen category (or keep all)
shuffle and take the first N entries
render the type/subtype string and its extension
Because the entries come from a real table, the strings you get are ones a
browser or server would actually emit in a Content-Type header.
Practical scenarios where this saves time
Testing an upload endpoint’s allow-list. If your file-upload handler accepts a hardcoded allow-list like ["image/png", "image/jpeg", "image/gif"], you need test cases that both pass and fail validation. Generating a batch of random image types gives you a ready set of allowed and disallowed variants to run through your test suite without manually curating them.
Fuzzing a content-type parser. A parser that reads the Content-Type header needs to handle any valid IANA string gracefully. Feeding it a random selection of real registered types — not invented ones — is a realistic fuzz strategy that surfaces parser bugs without fabricating edge cases.
Building mock API responses. When you stub a file-serving endpoint in tests, you need plausible Content-Type values for each mocked response. Generating them from a real IANA list means your mocks reflect real-world variety rather than the three types you happened to remember.
Documentation and example payloads. If you are writing API documentation that includes example request bodies with file metadata, realistic MIME type values make the docs more credible and useful than "type/subtype" placeholders.
Things to know about MIME types in practice
- A
Content-Typemay include parameters after a semicolon, most commonly a charset such astext/html; charset=utf-8. When validating uploads, match on thetype/subtypeportion before the semicolon. - File extensions are a hint only — a renamed
.jpgfile can have any content. For uploads you intend to process, validate the actual file magic bytes in addition to the declared MIME type. - The
application/octet-streamtype is the generic binary fallback. Browsers and servers use it when no more specific type is known. A permissive upload handler that allows it will accept almost anything. - Some types — like
application/x-www-form-urlencodedandmultipart/form-data— are used by browsers for form submission rather than file content. Your upload handler likely treats them differently from discrete file types. - IANA maintains the authoritative registry of media types. Vendor-specific subtypes use the
vnd.prefix (for exampleapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetfor modern Excel files), while experimental or personal types usex.orx-prefixes.