What Is an XBM File?

How to open, edit, & convert XBM files

What to Know

  • An XBM file is an X Bitmap Graphic file.
  • Open one with IrfanView, XnView, or LibreOffice Draw.
  • Convert to JPG, PNG, etc., with some of those same programs.

This article explains what an XBM file is, how to open one, and what program you need to have to convert XBM to JPG, PNG, and other image formats.

What Is an XBM File?

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 with IrfanView, XnView, or LibreOffice Draw, and possibly with GIMP or ImageMagick. Some of those programs work on other operating systems, too.

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 doing this 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 text editor. As mentioned above, if your XBM file is an X Bitmap Graphic file then you'll of course see the text similarly 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 file, but it's the wrong application or you'd rather have another installed program open it, 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 one to DDS (DirectDraw Surface), but we haven't tested it to confirm.

File Still Won't Open?

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

Lots of files use three letters for the extension, so many are bound to share the same letters. But this doesn't mean that the formats are related or that the same program can be used to open all of them.

Was this page helpful?