Free webp to jpg
XBM

X Bitmap (Legacy MIME Alias)

image/x-xbm Released 1988 · by MIT / X Consortium (X Window System)

The image/x-xbm MIME type is a common unofficial alias for the X Bitmap (XBM) format, a plain-text raster image format developed in the late 1980s for the X Window System (X11). Structurally formatted as valid C source code, an XBM file represents 1-bit monochrome (black and white) pixels as a static array of hexadecimal byte values that can be compiled directly into C or C++ programs. While 'image/x-xbitmap' is the more traditional long-form MIME identifier, 'image/x-xbm' is frequently encountered in legacy Apache/Nginx configurations, older web server mappings, and historic Unix application suites.

Legacy & Raster Graphics Transparency Production Ready

Technical Specifications

MIME Type
image/x-xbm
Extensions
.xbm
Container
C Source Code Header (.h)
Compression
Uncompressed (Source Code)
Algorithms
None
Color Depth
1-bit (Monochrome)
Metadata
None
Capabilities
Transparency
Animation
Progressive Loading
Alpha Channel
HDR Support
Official Specification
Aliases: image/x-xbitmapimage/xbmapplication/x-xbitmap

Magic Bytes & HTTP Headers

File Signature (Magic Bytes)
23 64 65 66 69 6e 65 (ASCII '#define')
ASCII: #define
HTTP Headers
Content-Type: image/x-xbm
Content-Type: image/x-xbitmap
HTML Accept Attribute
accept="image/x-xbm, image/x-xbitmap, .xbm"

Browser Support Matrix

Browser Status Min Version
Chrome Chrome
Not Supported
Firefox Firefox
Not Supported
Safari Safari
Not Supported
Edge Edge
Not Supported
Internet Explorer Internet Explorer
Supported Legacy

Advantages & Limitations

Advantages
  • Can be compiled directly into C or C++ source code without needing an external file loader or binary asset manager
  • Human-readable structure allows developers to inspect, edit, or hand-craft tiny icons directly within a text editor
  • Extremely predictable and lightweight for 1-bit hardware displays and embedded systems
Limitations
  • Strictly limited to 1-bit monochrome (black and white) graphics with no gray or color support
  • Text-based C syntax creates massive file bloat compared to binary 1-bit formats like PBM
  • Completely deprecated in modern web browsers and desktop GUI frameworks

Developer Code Snippets

import magic
# Libmagic can identify XBM files by scanning the text content for C preprocessor macros
print(magic.from_file('icon.xbm', mime=True)) # Outputs 'image/x-xbitmap' or 'text/plain'
const fs = require('fs');
// Reading the first few bytes to check for the '#define' C preprocessor directive
const buffer = Buffer.alloc(7);
const fd = fs.openSync('icon.xbm', 'r');
fs.readSync(fd, buffer, 0, 7, 0);
fs.closeSync(fd);
const isXBM = buffer.toString('ascii') === '#define';
console.log('Is X Bitmap (XBM):', isXBM);
import (
    "bytes"
    "net/http"
)
// Native Go HTTP detection will likely return text/plain because XBM is valid source code.
// Check directly for the #define prefix:
// isXBM := bytes.HasPrefix(buf, []byte("#define"))
$mime = mime_content_type('icon.xbm');
echo $mime; // May return 'image/x-xbm', 'image/x-xbitmap', or 'text/plain' depending on the system's magic database rules.

File Detection Steps

How to programmatically detect a image/x-xbm file by reading its raw bytes:

  1. 1 Because XBM files are text files rather than binary files, traditional binary magic numbers do not apply.
  2. 2 To detect an XBM file programmatically, check if the file begins with standard C preprocessor directives, specifically the ASCII string '#define' (Hex: 23 64 65 66 69 6E 65).
  3. 3 When encountering 'image/x-xbm' in web server configurations or uploads, you can safely normalize it to 'image/x-xbitmap' or treat it as text-based 1-bit raster data.

Software Support

ImageMagick ImageMagick
GIMP GIMP
X
XnView
G
GCC (GNU Compiler Collection - native compilation)

Conversion Tools

Share & Embed

Markdown Badge
XBM Format Badge
[![XBM Format](https://freewebptojpg.com/mime/image/xbm/badge.svg)](https://freewebptojpg.com/mime/image/xbm)
Interactive iframe Widget
<iframe src="https://freewebptojpg.com/mime/image/xbm/embed" width="100%" height="280" style="border:1px solid #cbd5e1;border-radius:8px;" title="XBM Specs"></iframe>

JSON API

All data on this page is available as a free, open JSON API. Use it in your project, documentation, or tooling.

GET https://freewebptojpg.com/mime/image/xbm.json Open JSON
Free to use
No auth required
CORS enabled
Use from any domain
Cached 24h
Cache-Control headers set

Frequently Asked Questions

What is the difference between image/x-xbm and image/x-xbitmap?

There is no difference in the underlying file. Both MIME types refer to the exact same XBM (X Bitmap) file format. 'image/x-xbm' is simply a shorter shorthand alias commonly used in web server configuration files like mime.types.

Can I open an XBM file in a text editor?

Yes. Because an XBM file is literally written in C programming language syntax, you can open it in any text editor to view the image dimensions (`#define ... width/height`) and the array of hex values representing the pixels.

How do I detect an XBM file programmatically?

Because XBM files are plain-text files written in C source code rather than binary files, they lack traditional binary magic numbers. You can detect them by checking if the file begins with the ASCII string '#define'.

Share this format