{"id":"image-x-icon","mimeType":"image/x-icon","name":"Windows Icon (Legacy MIME)","shortName":"ICO","category":"Icons \u0026 UI","extensions":[".ico"],"description":"The image/x-icon MIME type represents the Windows Icon (ICO) format, developed by Microsoft in 1985. An ICO file is a container that bundles one or more images at multiple sizes and color depths, allowing the operating system to dynamically scale the icon depending on the display context (e.g., a 16x16 taskbar icon vs. a 256x256 desktop icon). While historically storing modified, uncompressed Windows Bitmaps (BMP), modern ICO files (since Windows Vista) can also encapsulate highly compressed PNG images. Though 'image/vnd.microsoft.icon' is the official IANA standard, 'image/x-icon' remains the heavily entrenched de facto standard used by web servers for favicons.","seo":{"title":"image/x-icon MIME Type | Developer Reference for Windows ICO","description":"Complete reference for the image/x-icon MIME type: Windows ICO format, favicons, multi-resolution containers, PNG compression, and magic bytes.","faqs":[{"question":"What is the difference between image/x-icon and image/vnd.microsoft.icon?","answer":"Both represent the exact same .ico file format. 'image/vnd.microsoft.icon' was officially registered with IANA in 2003, making it the technical standard. However, 'image/x-icon' was used for over a decade prior and remains the most widely recognized MIME type by web servers and browsers for rendering favicons."},{"question":"What is an ICO file?","answer":"An ICO file is a computer icon format used natively by Microsoft Windows and ubiquitously across the web as a 'favicon'. It acts as a container holding multiple versions of the same image at different sizes (like 16x16, 32x32, and 256x256) so it always looks sharp."},{"question":"Should I still use .ico files for website favicons?","answer":"While a basic 'favicon.ico' placed in your website's root directory is an excellent fallback for older browsers and RSS readers, modern web development best practices recommend primarily using SVG or high-resolution PNG files for favicons, reserving the .ico format purely for legacy compatibility."}]},"index":{"compression":["Uncompressed (DIB/BMP)","Deflate (Embedded PNG)"],"browserSupport":{"score":5,"label":"Excellent"},"commonUses":["Website Favicons (favicon.ico)","Windows Application Executable Icons (.exe)","Desktop Shortcut Icons"]},"technical":{"magicBytes":{"hex":"00 00 01 00","ascii":"\\x00\\x00\\x01\\x00"},"container":"ICO Directory Structure","compressionAlgorithm":["None","Deflate (via PNG)"],"colorDepth":["1-bit","4-bit","8-bit","24-bit (True Color)","32-bit (RGBA)"],"transparency":true,"animation":false,"metadata":{"exif":false,"xmp":false,"iccProfile":false},"alphaChannel":true,"progressiveLoading":false,"hdrSupport":false},"history":{"developer":"Microsoft Corporation","released":"1985","specification":"Microsoft Windows Icon Structure Documentation"},"browserSupport":{"chrome":true,"chromeVersion":"1","firefox":true,"firefoxVersion":"1","safari":true,"safariVersion":"1","edge":true,"edgeVersion":"12","internetExplorer":true},"softwareSupport":[{"name":"ImageMagick","logo":"image-magic.webp"},{"name":"GIMP","logo":"gimp.svg"},{"name":"Adobe Photoshop (Native in recent versions)","logo":""},{"name":"Microsoft Visual Studio","logo":""}],"conversion":{"convertTo":["png","icns","svg"],"convertFrom":["png","svg","jpeg"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/x-icon"},{"header":"Content-Type","value":"image/vnd.microsoft.icon"}],"htmlAccept":"image/x-icon, image/vnd.microsoft.icon, .ico","fileDetection":["Check the first 4 bytes. An ICO file always begins with the magic bytes 00 00 01 00.","The next two bytes (bytes 4 and 5) represent the number of images bundled within the file as a little-endian short integer.","Immediately following is the Icon Directory structure, where each 16-byte entry describes an embedded image's dimensions, color depth, size, and offset."]},"prosCons":{"pros":["Universally supported by every web browser in existence for website favicons","Packs multiple resolutions into a single file, eliminating the need to serve different files for the taskbar vs. the desktop","Modern support for embedded PNGs (since Windows Vista) allows for excellent 32-bit transparency (alpha channels) and drastically reduced file sizes"],"cons":["Internal file structure is convoluted due to decades of legacy cruft, such as the requirement for BMP data to lack a standard file header but double the height property for an archaic XOR/AND mask","Larger file size compared to a single optimized PNG or SVG, as it literally stores the same image multiple times at different scales","The MIME type landscape is highly fragmented (x-icon vs. vnd.microsoft.icon), causing occasional caching or strict-MIME validation errors on restrictive servers"]},"specifications":{"url":"https://learn.microsoft.com/en-us/windows/win32/menurc/about-icons","rfc":"","mimeAliases":["image/vnd.microsoft.icon","image/ico","image/icon","text/ico","application/ico"]},"developerSnippets":{"python":"import magic\n# Libmagic natively detects the ICO magic bytes\nprint(magic.from_file('favicon.ico', mime=True)) # Outputs 'image/vnd.microsoft.icon' or 'image/x-icon'","nodejs":"const fs = require('fs');\n// Manually detecting the ICO magic bytes (00 00 01 00)\nconst buffer = Buffer.alloc(4);\nconst fd = fs.openSync('favicon.ico', 'r');\nfs.readSync(fd, buffer, 0, 4, 0);\nfs.closeSync(fd);\nconst isICO = buffer[0] === 0x00 \u0026\u0026 buffer[1] === 0x00 \u0026\u0026 buffer[2] === 0x01 \u0026\u0026 buffer[3] === 0x00;\nconsole.log('Is Windows ICO:', isICO);","go":"import (\n    \"bytes\"\n    \"net/http\"\n)\n// Native Go HTTP detection reads the ICO magic bytes natively\n// mime := http.DetectContentType(buf) // Returns \"image/x-icon\"","php":"$mime = mime_content_type('favicon.ico');\necho $mime; // Standard setups will often resolve this to 'image/vnd.microsoft.icon' or 'image/x-icon'"},"relatedFormats":["png","bmp","svg"]}
