MIME Types Explained: How a Website Identifies the Content It Sends
How does a browser know which kind of file arrived? The response Content-Type identifies the media type the server says it is sending.
1:47 · No narration: the video shows each step as text on screen, and every step is written out below, with buttons that jump the video to it.
Prefer YouTube? Watch this video on our YouTube channel (opens in a new tab).
The six points in the video
This is a silent video. The headings, explanations and labels below reproduce the information on screen.
-
Step 1: Read the type and subtype
A media type combines a general category with a specific subtype.
On-screen labels: General type; Slash separator; Specific subtype.
-
Step 2: Look at a real example
A response such as text/html identifies HTML content.
On-screen labels: text/html; HTML content; Browser handling.
-
Step 3: Inspect the response header
The server normally supplies the type in Content-Type.
On-screen labels: Server response; Content-Type header; Actual value.
-
Step 4: Keep file and type consistent
The browser needs a suitable type for the content it receives.
On-screen labels: Actual content; Suitable type; Correct handling.
-
Step 5: Check text parameters
A charset parameter can describe the encoding used for text.
On-screen labels: Text response; Charset parameter; Matching encoding.
-
Step 6: Test the receiving application
Check that the intended browser or application opens the resource correctly.
On-screen labels: Intended application; Expected behaviour; Useful result.
A practical check for your business
Inspect a real response rather than relying on the file label. Confirm that Content-Type matches the delivered content and that the intended browser or application handles it correctly.
Sources and further detail
Common questions
How does a browser know which kind of file arrived?
The response Content-Type identifies the media type the server says it is sending. Ask your developer to check the response type and the actual file together.
Go further
More video tips
All 205 videos →
File Archives Explained: Packaging, Compression and the Files Inside
File archives, explained.
Character Encoding Explained: Why Text Can Display Incorrectly
Character encoding, explained.