.XPM

XPM File

X PixMap
Ask a question
QUICK ANSWER

An XPM file is an X PixMap - a plain-text ASCII image encoding a small indexed-color icon, used mainly in Linux and Unix X11 desktop environments. Open it with GIMP, IrfanView, or XnView on Windows; on Linux, GIMP or ImageMagick handle it from the command line. There are no safety concerns: it is a text file and cannot contain executable code.

Developer: Daniel Dardailler and Colas Nahaboo (Bull Research Center, Sophia Antipolis, France); later maintained by Arnaud Le Hors Category: Raster Image Files Open standard MIME: image/x-xpixmap
OPENS ON Windows macOS Linux Web
Related: .JPG · .PNG · .TIF · .ECW

On this page

19k+ extensions indexed
Last reviewed Aug 6, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the XPM file format?

An .xpm file stores a raster image in the X PixMap format - a plain-text, indexed-color format native to the X Window System. Unlike most image formats, an XPM file is also valid C source code: it declares a static string array that C and C++ programs can #include directly, without a separate image-loading step.

XPM3, the current and only widely used version, begins with the ASCII comment /* XPM */ at byte offset zero, followed by a C array definition. The first string in the array encodes the image dimensions, color count, and how many ASCII characters represent each pixel (1-4). Subsequent strings define a color table, mapping those character codes to X11 color names (such as cornflowerblue) or hex RGB values (#RRGGBB). Transparency is expressed by mapping a pixel code to the special name None - a mechanism that predates PNG alpha transparency by several years.

Because the format is pure ASCII, .xpm files can be version-controlled, diff'd, and generated programmatically without binary tools. File size grows linearly with pixel count, making the format impractical for photographs but well-suited for small icons and UI bitmaps.

XPM remains the native icon format for many X11 toolkits such as Motif and legacy GTK. Modern Linux desktops prefer SVG or PNG for icons, but X11 applications still commonly ship XPM fallbacks. GIMP, ImageMagick, XnView, and IrfanView all support the format on modern systems.

Security & safety

RISK: LOW

XPM is a plain-text ASCII format; it cannot contain executable code or macros. Malformed XPM files could theoretically trigger bugs in parsing libraries (historical CVEs exist in libXpm on X11 systems), but modern patched versions are not vulnerable. Risk for everyday users is negligible.

Format details

in a nutshell
FULL NAMEX PixMapaka XPM image, X Pixmap
DEVELOPERDaniel Dardailler and Colas Nahaboo (Bull Research Center, Sophia Antipolis, France); later maintained by Arnaud Le Horssince 1989 (XPM1, Daniel Dardailler, Bull Research Center)
MIME TYPEimage/x-xpixmap
TYPEText-based indexed-color raster image (C source/ASCII file)
STANDARDOpen · royalty-free

Programs that open XPM files

Windows6 apps
GIMP Open-source File > Open to view and edit XPM images. Export to PNG, BMP, JPG etc. via File > Export As.
XnView Free Open and view XPM; convert via Tools > Convert or right-click > Convert.
PaintShop Pro Paid Opens XPM; edit and save/export to other formats.
CorelDRAW Paid Import XPM as a raster image (File > Import); not a native format but importable.
IrfanView Free Open the XPM file directly; convert with File > Save As (batch conversion available).
ACDSee Photo Studio Paid View and convert XPM; browse XPM files in the asset library.
macOS3 apps
GIMP Open-source Download GIMP for macOS; opens and exports XPM.
XnView MP Free View and convert XPM on macOS.
Pixelmator Pro Paid Opens XPM as a raster image for editing.
Linux4 apps
GIMP Open-source Native XPM support; open, edit, and export. On Ubuntu/Debian: sudo apt install gimp.
XnView MP Free Multiplatform viewer/converter; supports XPM natively.
ImageMagick (convert) Open-source CLI: 'convert image.xpm image.png' - fast batch conversion of XPM to any format.
eog (Eye of GNOME) Open-source Built-in GNOME image viewer; opens XPM for viewing (read-only).
Web1 app
Convertio Freemium Upload XPM, convert to PNG/JPG/BMP online. File size limits apply.

Technical details

deep spec
File encodingPlain ASCII text (7-bit safe; also valid C source code)
File signature/* XPM */ at byte offset 0 (XPM3); XPM2 files start with ! XPM2
Color modelIndexed palette; 1-4 printable ASCII characters per pixel map to color entries
Color specificationX11 color names (e.g. cornflowerblue) or #RRGGBB hex values per palette entry
TransparencyNone X11 color name maps a pixel code to full transparency (no separate alpha channel byte)
CompressionNone - each pixel stored as 1-4 literal ASCII characters
Format versionsXPM1 (1989, monochrome C macros), XPM2 (1990, standalone data), XPM3 (1991, C syntax - current)
Maximum paletteUp to 65,536 simultaneous indexed colors
MIME typeimage/x-xpixmap
DimensionsNo hard limit; file size grows linearly with pixel count (each pixel = chars_per_pixel ASCII bytes)
C integrationFile content can be #included directly into C/C++ source and compiled without a loader
Released1989 (XPM1, Daniel Dardailler, Bull Research Center)
Latest versionXPM3 (1991), documented in XPM Manual v3.4i (September 1996, Arnaud Le Hors)
Open standardYes · royalty-free
Specificationwww.xfree86.org

XPM conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with XPM files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about XPM files.

Frequently asked questions

What is an XPM file?
An X PixMap - a plain-text ASCII image used primarily for small icons in Linux/Unix X11 desktop environments. It encodes color pixel data as a C source array.
How do I open an XPM file on Windows?
GIMP, IrfanView, XnView, or PaintShop Pro all open XPM on Windows. GIMP and IrfanView are free.
How do I convert XPM to PNG?
In GIMP: File > Open the XPM, then File > Export As > PNG. In IrfanView: File > Save As > PNG. On Linux command line: 'convert image.xpm image.png' (ImageMagick).
Can I open an XPM file in a text editor?
Yes - XPM3 is valid ASCII text and readable in any text editor. You will see the color table and pixel rows as character sequences, though this is not useful for viewing the image.
Why is XPM used in Linux programming?
XPM is a C array, so icons can be #included directly into C source code at compile time, embedding the image in the binary without separate resource files. It was the standard approach for X11 app icons in the 1990s-2000s.
What replaced XPM?
PNG (for icons with transparency) and SVG (for scalable icons) replaced XPM in modern Linux desktops. The Freedesktop icon theme standard uses PNG/SVG. XPM remains in legacy and lightweight systems.

References

1X PixMap - Wikipediaen.wikipedia.org
2XPM format summary - FileFormat.infowww.fileformat.info

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.MDMarkdown Document
3.CRDOWNLOADChrome Partial Download File
4.BINCD/DVD Disc Image (BIN/CUE)
5.PARTPartial Download File
6.RPMSGRestricted Permission Message
7.NOMEDIAAndroid No-Media Marker File
8.EXEWindows Executable (Portable Executable)
9.AVIFAV1 Image File Format (AVIF)
10.ICSiCalendar data file

Related extensions

.JPGJPEG Image
.PNGPortable Network Graphics
.TIFTagged Image File Format
.ECWEnhanced Compression Wavelet (ECW) image
.AVIFAV1 Image File Format (AVIF)
.JP2JPEG 2000 Image (ISO/IEC 15444-1)

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z