What is an XBM File?

How to Open, Edit, & Convert XBM Files

Screenshot of a USB XBM file open in XnView
An XBM File Open in XnView.

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, XBM files are C language source files, meaning they aren't meant to be read by a graphical display program, but instead with a C compiler.

How To Open an XBM File

XBM files can be opened with popular image file viewers like IrfanView and XnView, as well as with LibreOffice Draw. You might also have luck viewing an XBM file with GIMP or ImageMagick.

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 USB icon. The image at the top of this page is what's generated from this text:

#define usb_width 8
#define usb_height 8
static unsigned char usb_bits[] = {
 0x70, 0x88, 0xC4, 0xE2, 0x7E, 0x32, 0x09, 0x07 };

Tip: I don't know of any other formats that use the .XBM file extension, but if your file isn't opening using the suggestions above, you see what you can learn via Notepad++ or another text editor. As I 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 may 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 my 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 I haven't tested it myself to confirm.