What is PBM? Portable Bitmap Format Explained

PBM (Portable Bitmap) is the bi-level black-and-white member of the Netpbm family, invented by Jef Poskanzer, storing 1-bit images in ASCII or binary form.

Free online file converter tool. Works in Chrome Firefox Safari Edge Opera and other modern browsers on Windows macOS Linux Android and iOS. No software installation or sign-up required. All conversions run directly in your browser, so your files never leave your device. Free to use with no account needed.

Image

What is PBM? Portable Bitmap Format Explained

The simplest Netpbm format, storing one-bit black-and-white images in a plain or binary layout.

Last updated:

Year Created1980s
CompressionRaster image (1-bit)
Primary UseSimple bitmap interchange

What is PBM?

PBM, the Portable Bitmap format, is the simplest member of the Netpbm family of image formats. It was invented by Jef Poskanzer in the mid-1980s to allow images to be sent reliably through email and exchanged easily between different systems.

A PBM file stores a bi-level (black-and-white) image where each pixel is a single bit. Files start with a two-byte magic number, P1 for the plain ASCII variant and P4 for the binary (raw) variant, followed by the image width and height and then the pixel data. The deliberately minimal structure makes the format trivial to read and write.

How PBM Works

A PBM file consists of a tiny ASCII header followed by pixel data. The header is a two-byte magic number, then the width and height as ASCII decimal numbers separated by whitespace.[1] In the plain P1 variant each pixel is the ASCII character 0 or 1; in the raw P4 variant pixels are packed eight to a byte. By convention a 1 bit denotes black and 0 denotes white, the reverse of most conventions.[1]

History and the Netpbm Family

Jef Poskanzer created the format in the mid-1980s so images could survive transmission through 7-bit email gateways, which is why the plain variant uses only printable ASCII.[2] PBM is the bi-level base of the Netpbm family, which extends upward to grayscale (PGM) and full color (PPM); the three are collectively addressed by the PNM specification.[3]

PBM vs Other Formats

Unlike compressed formats such as PNG or GIF, PBM applies no compression in its plain form and only minimal bit packing in its raw form, so files are larger but trivially simple to parse.[2] This simplicity makes it a popular intermediate format in image-processing pipelines and the Netpbm toolkit, where conversions chain together easily.[3]

MKV Technical Specifications

DeveloperJef Poskanzer (Netpbm / Pbmplus)[1]
File Extension.pbm[1]
MIME Typeimage/x-portable-bitmap[1]
ReleasedMid-1980s (Pbmplus 1988)[1]
CompressionNone[1]

PBM vs Other Image Formats

FeaturePBMPNGBMP
TypeRasterRasterRaster
Color depth1-bit (bilevel)[1]Up to 16-bitUp to 32-bit
CompressionNone[1]LosslessNone or RLE
TransparencyNoYesLimited
EncodingASCII or binary[1]BinaryBinary
Best forSimple bitmaps[2]Web graphicsWindows images

PBM stores only black-and-white pixels in a deliberately simple format, trading efficiency and features for ease of generation and parsing.

Advantages & Disadvantages

Advantages

Extremely simple | FileFormer

The minimal header and 1-bit pixels make PBM one of the easiest image formats to read and write programmatically.

Plain-text option | FileFormer

The P1 ASCII variant stores pixels as human-readable 0s and 1s, useful for debugging and quick generation.

Highly portable | FileFormer

Designed for cross-platform exchange, it works consistently across systems and many image tools.

Tiny for line art | FileFormer

For purely black-and-white images, 1-bit pixels keep the binary variant compact.

Disadvantages

Black and white only | FileFormer

PBM cannot represent grayscale or color; those require the related PGM and PPM formats.

No compression | FileFormer

Pixel data is stored uncompressed, so it is inefficient for large images compared with PNG.

Verbose ASCII variant | FileFormer

The plain P1 form is space-inefficient because each pixel is written as text.

Common Use Cases

PBM is used where a dead-simple, portable bi-level image is all that is needed.

Programmatic image generation | FileFormer

Scripts and programs emit PBM because the format is trivial to write by hand or in code.

Image-processing pipelines | FileFormer

Netpbm tools use PBM as an intermediate format when converting or manipulating bitmaps.

Fax and line-art data | FileFormer

Bi-level content such as scanned text or fax-style images maps naturally onto PBM.

Convert PBM Files Free

Use our free online image converter to convert PBM and other formats - no signup, no watermarks.

Try Image Converter Free

Frequently Asked Questions

What is the difference between PBM, PGM, and PPM?

PBM stores 1-bit black-and-white images, PGM stores grayscale images, and PPM stores full-color images. Together they form the Netpbm (PNM) family.

What do the magic numbers P1 and P4 mean?

P1 marks a plain ASCII PBM file, while P4 marks the binary (raw) PBM variant. Both store the same kind of 1-bit image.

Who invented the PBM format?

Jef Poskanzer created PBM in the mid-1980s; it became the basis of the Pbmplus and later Netpbm toolkits.

Is PBM compressed?

No. PBM stores pixel data uncompressed, which keeps the format simple but inefficient for large images.

Why would anyone still use PBM?

Its simplicity makes it ideal as an intermediate format in image-processing pipelines and for quick programmatic generation of bitmaps.

References

  1. The PBM Format - Netpbm Official Documentation
  2. Netpbm - Wikipedia
  3. Netpbm formats - Just Solve the File Format Problem