1984: The X Window System needs cursors
The history of XBM begins at the Massachusetts Institute of Technology (MIT). In 1984 a research group led by Robert Scheifler and Jim Gettys was working on the X Window System — a network-capable window management system for Unix machines that could run applications on a central server and display them on various workstation screens. X later became the de facto standard for Unix GUIs and remains, to this day (via X11 and Wayland), the foundation of Linux desktops.
X needed an image format for cursors and small UI symbols. The requirements were unusual:
- Platform-independent. X ran on Sun, DEC, IBM, HP and many other workstations with differing byte orders. A binary format with endianness problems was out of the question.
- Embeddable in C source code. Cursor data should be embeddable directly into X application code as static arrays.
- Easy to edit. Modifiable with a text editor, without special image-processing software.
XBM: 1-bit cursors as C code
The result was X BitMap (XBM). An XBM file is literally C source code. For example, a 16×16 cursor looks like this:
#define cursor_width 16
#define cursor_height 16
static unsigned char cursor_bits[] = {
0x00, 0x00, 0x18, 0x00, 0x3c, 0x00, 0x7e, 0x00,
0xff, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00 };This was elegant: the XBM is simultaneously an image file and a compilable C header file. An X programmer could create a cursor image with a drawing program, save it as XBM and embed it directly into the program's source code via #include. No separate decoder, no file I/O at runtime — the cursor data ended up right in the binary.
1989: XPM arrives for more color
XBM was limited to 1 bit per pixel — black or white, no gray, no color. For the first X cursors that was sufficient, but as screens became more complex (4-bit gray, 8-bit color, later 24-bit truecolor), X needed an extended format.
In 1989 Daniel Dardailler and Colas Nahaboo at Bull Research developed the X PixMap (XPM) format. XPM keeps XBM's text-based C-source-code architecture, but extends it with color palettes and several color modes (monochrome, grayscale, color, symbolic).
An XPM file for a small 4-color icon, for example, looks like this:
/* XPM */
static char *icon[] = {
"8 8 4 1",
" c None",
". c #000000",
"+ c #FF0000",
"@ c #FFFFFF",
"..++++..",
".++@@++.",
"+@@@@@@+",
"+@@..@@+",
"+@@..@@+",
"+@@@@@@+",
".++@@++.",
"..++++.." };Each pixel is represented by an ASCII character, and the color mapping sits in the header. The format is like a textual pixel-art notation — directly editable in a text editor, without having to convert hex values.
Unix adoption and Linux distributions
XBM and XPM became the de facto standard formats in Unix applications. Thousands of X apps stored their icons as XPM files: xeyes, xclock, xterm, many window managers (twm, fvwm, WindowMaker) and the first desktop environments (CDE, later GNOME 1.0 and KDE 1.0).
Linux distributions inherited this tradition. A tour through /usr/share/icons/on an old Slackware or Debian installation reveals countless XPM files. Applications like xfig (vector drawing software for Unix) had extensive XPM libraries.
1990s: The first web browsers support XBM
A remarkable episode: the first web browsers (NCSA Mosaic, Netscape Navigator 1.0) supported XBM as one of their image formats. In the early days of the web, web designers could embed small black-and-white icons as XBM — and the browser would display them. This support disappeared with the rise of GIF (see our GIF history) and later JPG.
Current browsers no longer support XBM. Firefox was one of the last browsers that could render XBM; in modern Firefox versions the support has been removed.
2000s: PNG displaces XPM
With the emergence of PNG (see our PNG history) XPM lost its position in the Unix world too. PNG offered better compression, 24-bit true color, a real alpha channel and was binary — thus smaller and faster to decode. Modern Linux desktop environments (GNOME 2.0 from 2002, KDE 4.0 from 2008) switched to PNG for icons; SVG came later for scalable variants.
XPM survives, however, in specific niches. Some open-source programs still use XPM because migrating to PNG brings no technical advantage: the program starts, has a single 32×32 icon, and an XPM header is enough. Bitmap-editor teaching toolsfor computer-science courses also use XBM/XPM, because the text-based format makes concepts such as pixel data and compression easy to visualize.
XBM/XPM in 2026: a living legacy
In 2026 the formats are in an interesting position: no longer actively used for new content, but not gone from the world either. A Linux distribution like Debian still contains thousands of XPM files, because many old applications use them and no one carries out the migration. GIMP, ImageMagick, GTK+ and Qt continue to support XBM and XPM — migrating is an ongoing maintenance task, not an emergency.
For modern web or photo applications, XBM and XPM are irrelevant. Anyone who comes across an XBM/XPM file can convert it to PNG with GIMP or ImageMagick — which takes 5 seconds and makes the asset web-ready.
What we learn from XBM/XPM
- Platform independence is powerful. A text-based format works on any machine, any byte order, with any text editor. XBM has survived 40 years.
- Source-code embedding was revolutionary. Direct integration into C programs enabled an elegant asset pipeline that is relevant again today with JavaScript asset bundlers.
- Simple formats have a long lifespan. The entire XBM decoder is 50 lines of C code. Formats like that don't become obsolete.
When XBM/XPM is the right choice
- Embedded C/C++ projects. Direct embedding of small cursor or icon images as static arrays.
- Teaching examples for image formats. The text-based architecture makes concepts understandable.
- Linux legacy applications. When the software expects XPM, it remains the choice.
- Pixel art as a source-code asset. Some indie game developers use XPM-like notations for small pixel-art sprites.
When XBM/XPM is not ideal: web delivery (no browser support), modern applications with alpha transparency, photographic content (XPM is limited to a few colors), anything that isn't specifically Unix legacy or educational.
Sources
Wikipedia — X BitMap · Wikipedia — X PixMap · X.Org Foundation · FileFormat.Info — XBM · FileFormat.Info — XPM · ImageMagick — Format support for XBM/XPM · Scheifler, R. & Gettys, J., "X Window System: The Complete Reference to Xlib", Digital Press 1992.