128,191,059 files
4,6 Trustpilot
since 2013

All about PBM files

5.0/5(1 vote)

PBM is probably the simplest image format in the world. It’s represented solely by 0s and 1s, and each number corresponds to a pixel. The row and column numbers in the text determine the position in the image. This means you can even create images using a text editor—almost as if you were coloring in graph paper with a pencil. PBM supports no compression, no alpha channels, and no colors. Not even grayscale. It can simply draw a pixel (1) or not (0).

TLDR:

PBM files are part of a larger family of formats. The format and its variants are still in use today, though they aren’t particularly well-suited for sharing or long-term archiving. They are large, supported by very few software programs, yet they are highly flexible and performant. If you find a PBM file, you’re likely looking at an intermediate product or an image created for educational purposes. This is because the PBM format is very well-suited for visual demonstration; it’s practically self-explanatory.

The History of PBM Files

PBM was invented in the 1980s by Jef Poskanzer, a programmer from Berkeley who wanted to solve a simple problem: sending images via email. Back in the 1980s, email wasn’t as advanced as it is today. Only ASCII characters could be sent reliably; binary files like images often got corrupted in transit. So, with PBM, Poskanzer designed an image format that solved exactly this problem.

The Technical Structure

In its plain variant (P1), a PBM image consists of exactly three parts: the magic number, the dimensions, and the actual pixel data. Comments can be used optionally, e.g., for the content.

Component Example Meaning
Magic Number P1 Plain PBM (ASCII variant)
Comment # mein bild Optional, introduced by # introduced
Width Height 24 7 Dimensions in pixels
Raster data 0 1 1 0 ... 1 = black, 0 = white

The following example shows a complete image from the documentation:

P1
# feep.pbm
24 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

(0s are shown slightly darker for better visualization)

The text "FEEP" is clearly visible between the zeros and ones. PBM thus corresponds to binary ASCII ;).

Plain vs. Raw: P1 and P4

Poskanzer later introduced a binary variant and made it the default output of the Netpbm tools. The Plain variant (P1) came first historically, but was replaced due to its much higher space requirements ("lavishly wasteful").

Feature Plain PBM (P1) Raw PBM (P4)
Pixel data ASCII characters 0 and 1 Bits, packed 8 per byte
Human-readable Yes, completely Only the header
Storage space per pixel ~2 bytes (character + whitespace) 1/8 byte (1 bit)
Max. line length 70 characters recommended No limit
Images per file Exactly 1 Multiple possible (since July 2000)

Today, the entire PBM family, particularly PPM, is often used as an intermediate format. In the simplest and shortest of all use cases, it exists only in a pipeline between two programs, meaning only for the execution time itself. This brings us to the strengths of the format:

Strengths of PBM files

  • No dependencies: No decoder, no library. A few lines of C, Python, or shell are enough to read and write.
  • Unix philosophy: PBM tools are filters. You pipe them together: cat bild.pbm | pbmtopgm | ppmtojpeg > out.JPG. Over 330 programs in the Netpbm package work this way.
  • Educational value: Anyone who wants to understand image processing (not image editing) should ideally start with PBM.
  • Robust: No broken header, no corrupted chunk. There’s so little data inside that hardly anything can go wrong. And even if a bit does flip, the image remains readable.

The PBM family

PBM isn’t alone. In late 1988, Poskanzer expanded the family to include PGM (Portable Gray Map, grayscale, magic number P2/P5) and PPM (Portable Pixel Map, RGB color, P3/P6). Together, they form PNM: Portable Any Map. Later, PAM (P7) was added as a universal extension.

PBM is the foundation and also the “most radical” member of the family, offering only two options: light on or light off—pixel present or absent. No color, no transparency, no grayscale. Just a black-and-white image readable directly in the source code.

Pbmplus and Netpbm

Poskanzer maintained Pbmplus until its final release in late 1991. After that, the project was no longer maintained. In 1993, Netpbm emerged as a community fork, essentially a repackaging of Pbmplus with bug fixes and extensions from developers worldwide. Since 1999, Netpbm has been maintained by Bryan Henderson and is now included in virtually every Linux distribution.

PBM as such has fallen out of favor. Mail servers can easily handle JPGs, PNGs, and even videos. The "colorful" variant, ppm, is still used daily, in pipes, on Linux systems. For PBM, the educational aspect remains: it’s wonderful to explain, wonderful to understand, and—PBM is that simple—can be explained on graph paper.

Sources

Netpbm PBM Format Specification
Netpbm History – a highly recommended article on the history of PBM
Wiki: Jef Poskanzer

5.0/5(1 vote)

Last updated on 6. April 2026 by Sören with the experience of more than 128,191,034 converted files since 2013.

Convert, open and edit PBM files

Details about PBM files

Software for opening PBM files
Software for editing PBM files
MIME-type for PBM

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Drop files here...