Skip to content

PBM (.pbm)

.pbm file signature | image/x-portable-bitmap

Portable bitmapbinary

Safe

Magic Bytes

Offset 0
50 31

Sources: Apache Tika

All Known Signatures

3 signature variants are documented for .pbm files across multiple sources.

Hex Signature Offset Sources
50 31 0 Apache Tika
50 31 0A 0 Wikipedia
50 34 0A 0 Wikipedia

Extension

.pbm

MIME Type

image/x-portable-bitmap

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .pbm files in Python

Python
def is_pbm(file_path: str) -> bool:
    """Check if file is a valid PBM by magic bytes."""
    signature = bytes([0x50, 0x31])
    with open(file_path, "rb") as f:
        return f.read(2) == signature

How to validate .pbm files in Node.js

Node.js
function isPBM(buffer: Buffer): boolean {
  const signature = Buffer.from([0x50, 0x31]);
  return buffer.subarray(0, 2).equals(signature);
}

How to validate .pbm files in Go

Go
func IsPBM(data []byte) bool {
    signature := []byte{0x50, 0x31}
    if len(data) < 2 {
        return false
    }
    return bytes.Equal(data[:2], signature)
}

API Endpoint

GET /api/v1/pbm
curl https://filesignature.org/api/v1/pbm

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .pbm file?

A .pbm file is a PBM file. Portable bitmapbinary

What are the magic bytes for .pbm files?

The magic bytes for PBM files are 50 31 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .pbm file?

To validate a .pbm file, read the first bytes of the file and compare them against the known magic bytes (50 31) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .pbm files?

The primary MIME type for .pbm files is image/x-portable-bitmap.

Is it safe to open .pbm files?

PBM (.pbm) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.