Skip to content

image/x-icon MIME Type — Meaning, Usage & Examples

image/x-icon
Extensions: .ico Class: image Spec: IANA

image/x-icon means: image/x-icon is the media type for ICO files, the Windows icon container traditionally used for website favicons. An ICO can hold multiple sizes and color depths in one file, letting browsers pick the appropriate rendition for tabs, bookmarks and shortcuts. Image media types identify raster and vector graphics. The subtype selects the decoder and influences compression, transparency and animation support. Serving the right image type lets browsers pick efficient decoding paths, enables responsive srcset negotiation, and avoids the broken-image icon that appears when bytes and declared type disagree. You will encounter image/x-icon in contexts such as website favicons referenced by link rel=icon; legacy browser and desktop shortcut icons; multi-resolution icon bundles. It is commonly associated with the file extension(s) .ico. Modern sites often use PNG or SVG favicons instead of ICO, but image/x-icon remains widely supported. The x- prefix marks it as a common unregistered-in-core type; serve .ico with this type and provide PNG/SVG alternatives for crisp high-DPI displays.

Advertisement
Ad slot · ref-top

When you'll see image/x-icon

  • Website favicons referenced by link rel=icon
  • Legacy browser and desktop shortcut icons
  • Multi-resolution icon bundles

How to handle it

When serving images, match the Content-Type to the actual encoded bytes, set long-lived cache headers for immutable assets, and provide width/height or aspect-ratio hints to avoid layout shift. Use responsive delivery (srcset, picture, or server content-negotiation) so clients receive a format they support at an appropriate resolution. Validate uploaded images by decoding them, not by trusting the extension or the client-supplied type. As a final checklist for image types: compress and resize for the display slot, serve modern formats with fallbacks, add width and height to prevent layout shift, cache immutable assets aggressively, and validate uploads by decoding rather than trusting the claimed type or extension.

Notes & gotchas

Modern sites often use PNG or SVG favicons instead of ICO, but image/x-icon remains widely supported. The x- prefix marks it as a common unregistered-in-core type; serve .ico with this type and provide PNG/SVG alternatives for crisp high-DPI displays.

Examples

HTTP
HTTP/1.1 200 OK
Content-Type: image/x-icon
Content-Disposition: inline; filename="sample.ico"

[binary image payload: the encoded bytes of a sample .ico]
curl
curl -i -H "Accept: image/x-icon" https://api.example.com/v1/resource   # inspect the returned Content-Type
JavaScript (fetch)
const res = await fetch("/media/sample.ico", { headers: { Accept: "image/x-icon" } });
const blob = await res.blob();            // blob.type should be "image/x-icon"
const url = URL.createObjectURL(blob);    // assign to img.src / audio.src / video.src
// revoke with URL.revokeObjectURL(url) when done to free memory
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource",
                   headers={"Accept": "image/x-icon"}, timeout=30)
res.raise_for_status()
assert res.headers["Content-Type"].startswith("image/x-icon")
with open("sample.ico", "wb") as fh:
    fh.write(res.content)   # raw bytes; use stream=True for large files

Frequently asked questions

Do I still need a favicon.ico?

Not strictly — modern browsers accept PNG and SVG favicons via link rel=icon. But a root favicon.ico is still requested by some clients, so providing one avoids 404 noise.

What type should a PNG favicon use?

image/png. You can declare sizes with the sizes attribute and offer an SVG favicon for scalable rendering; ICO is the legacy multi-size container.

How do browsers choose between image formats?

Through the Accept header and srcset/sizes or the picture element. The server can content-negotiate (e.g. serve WebP/AVIF to clients that accept it), and the declared Content-Type must match the bytes actually sent.

Does the file extension determine the MIME type?

No — the server declares Content-Type, and the bytes must match it. Extensions are a convenience for mapping, but a .png file served as image/jpeg, or vice versa, can render incorrectly or be rejected by strict clients.

How do I prevent layout shift when images load?

Set explicit width and height attributes (or CSS aspect-ratio) so the browser reserves space before the image arrives, and use responsive srcset/sizes to deliver an appropriately sized file for each viewport.

Advertisement
Ad slot · ref-in-article

Try the Base64 Encoder

Encode and decode Base64 with UTF-8 and URL-safe options.

Open tool →