Skip to main content

Command Palette

Search for a command to run...

Understanding HTTP MIME Types

Updated
2 min read

The internet hosts many kinds of resources, so each resource needs a label to tell clients how to handle it. MIME (Multipurpose Internet Mail Extensions) was originally developed to solve problems moving data between different mail systems, and the same concept is used by HTTP to indicate the media type of a resource.

MIME types are written as type/subtype.

Type

  • The type indicates the broad category of the data, for example: text, image, video, audio, application (binary or structured data), and multipart (multiple parts in a single message).
  • These categories are formally defined in standards such as RFC 2046.

Subtype

  • The subtype specifies the exact format inside the main type, for example: html, css, png, json.
  • Together the type/subtype pair precisely identifies the resource format (for example, text/html).

Common MIME types

  1. text/*
  • text/plain — plain text
  • text/html — HTML documents
  • text/css — CSS stylesheets
  • text/javascript (historical) or application/javascript — JavaScript
  • text/event-stream — Server-Sent Events (SSE)
  1. image/*
  • image/jpeg — JPEG images
  • image/png — PNG images
  • image/gif — GIF images (supports animation)
  • image/webp — WebP images
  1. audio/*
  • audio/mpeg — MP3 audio
  • audio/wav — WAV audio
  • audio/ogg — Ogg audio
  • audio/webm — WebM audio
  • audio/aac — AAC audio
  • audio/flac — FLAC (lossless) audio
  1. video/*
  • video/mp4 — MP4 video
  • video/webm — WebM video
  • video/ogg — Ogg video
  1. application/*
  • application/json — JSON data
  • application/xml — XML data
  • application/pdf — PDF documents
  • application/octet-stream — arbitrary binary data (default for unknown binaries)
  • application/zip — ZIP archives
  1. multipart/*
  • multipart/form-data — used for form submissions that include files
  • multipart/byteranges — multiple byte ranges in a single response

HTTP usage

  • Servers send the MIME type in the Content-Type response header so browsers and other clients know how to process the payload. Example:
    • Content-Type: text/html; charset=utf-8
4 views