What Is an XBM File?

How to open, edit, & convert XBM files

A file with the XBM file extension is an X Bitmap Graphic file used with the graphical user interface system called the X Window System to represent monochrome images with ASCII text, similar to PBM files. Some files in this format may instead use the .BM file extension.

While they aren't as popular anymore (the format has been replaced with XPM - X11 Pixmap Graphic), you might still see XBM files used to describe cursor and icon bitmaps. Some program windows may also use the format for defining the button images in the program's title bar.

XBM files are unique in that, unlike PNG, JPG, and other popular image formats, they're C language source files, meaning they aren't meant to be read by a graphical display program, but instead with a C compiler.

XBM keyboard file open in XnView

How to Open an XBM File

You can open an XBM file in Windows 10, 8, 7, and other versions of Windows with IrfanView, XnView, or LibreOffice Draw, and possibly with GIMP or ImageMagick. Some of those programs work on other operating systems, too.

If your XBM file isn't opening in those programs, double-check that you're reading the file extension correctly. You may be confusing a PBM, FXB, or XBIN file for an XBM file.

Since XBM files are just text files that the program interpreting it is able to use to generate the image, you can also open one with any text editor. Just know that opening the XBM file this way won't show you the image but instead just the code that makes up the file.

Below is one example of an XBM file's text content, which in this instance is for displaying a small keyboard icon. The image at the top of this page is what's generated from this text:

#define keyboard16_width 16
#define keyboard16_height 16
static char keyboard16_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10,
   0x08, 0x10, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0xa8, 0x1a,
   0x54, 0x35, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00};

We don't know of any other formats that use the .XBM file extension, but if your file isn't opening using the suggestions above, see what you can learn with a free text editor. As we mentioned above, if your XBM file is an X Bitmap Graphic file then you'll of course see the text in a similar fashion as the example above, but if it's not in this format you may still find some text within the file that could help you determine what format it's in and what program can open it.

If you find that an application on your PC does try to open the XBM file but it's the wrong application or if you would rather have another installed program open XBM files, see our How to Change the Default Program for a Specific File Extension guide for making that change in Windows.

How to Convert an XBM File

The File > Save as option in IrfanView can be used to convert an XBM file to JPG, PNG, TGA, TIF, WEBP, ICO, BMP, and several other image formats.

The same can be done through XnView with its File > Save As or File > Export menu option. The free Konvertor program is another way you can convert an XBM file to a different image format.

QuickBMS might be able to convert an XBM file to a DDS (DirectDraw Surface) file but we haven't tested it to confirm.