What is MIME type "image/x-xbitmap"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

image/x-xbitmap defines the X BitMap format. It represents simple, one-bit graphics used mainly with the X Window System.

This format stores images as plain text arrays written in C. This means image data is embedded directly in source code, making it a popular choice for icons and cursors in Unix‑like systems.

Files using this MIME type usually have the BM or XBM extension.

For more technical details, check out this Wikipedia page.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: image/x-xbitmap    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="image/x-xbitmap">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'image/x-xbitmap');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

Do modern web browsers support the image/x-xbitmap MIME type?

No, most modern browsers (including Chrome, Firefox, and Edge) have removed support for XBM images. While widely used in the early web, this format has been replaced by png, gif, and jpeg due to security and performance concerns.

Why are XBM files considered a security risk?

XBM files are actually valid C source code, which makes them vulnerable to Cross-Site Scripting (XSS) attacks. Because the file content is plain text code, attackers could historically embed malicious scripts that browsers might execute, leading to the format's deprecation on the web.

How do I configure Apache to serve .xbm files correctly?

You can add the MIME type definition to your .htaccess or main configuration file. Add the line AddType image/x-xbitmap .xbm .bm to ensure the server sends the correct header, though keep in mind modern browsers may not display the file.

How do I add image/x-xbitmap support to Nginx?

Locate your mime.types file (usually in /etc/nginx/) and ensure the following line exists inside the types block: image/x-xbitmap xbm bm;. Reload Nginx using sudo nginx -s reload to apply the changes.

What is unique about the file structure of image/x-xbitmap?

Unlike binary formats like JPEG or PNG, XBM is plain text. It consists of C language #define statements and a static array of bytes. This allows developers to #include the image directly into C programs for X Window System applications.

How can I convert an XBM file to a modern format?

You can use command-line tools like ImageMagick or desktop editors like GIMP and XnView. For ImageMagick, run convert input.xbm output.png to transform the legacy bitmap into a standard web-friendly image.

Is image/x-xbitmap the same as image/bmp?

No, these are completely different formats. image/x-xbitmap is a text-based format for Unix systems, while image/bmp is a binary raster format native to Microsoft Windows. They are not compatible with each other.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.