PBM (.pbm)
.pbm file signature | image/x-portable-bitmap
Portable Bitmap (PBM) is a simple monochrome image format originally defined by Jef Poskanzer and now maintained as part of the Netpbm family. It is used for storing black-and-white graphics, line art, icons, and intermediary image data in scripting, printing, and conversion workflows. PBM is a legacy format with minimal features, and files are generally safe, though untrusted images should still be handled by standard parsers.
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
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
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
func IsPBM(data []byte) bool {
signature := []byte{0x50, 0x31}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
/api/v1/pbm
curl https://filesignature.org/api/v1/pbm
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .pbm file?
A .pbm file is identified by the magic bytes 50 31 at byte offset 0. Portable Bitmap (PBM) is a simple monochrome image format originally defined by Jef Poskanzer and now maintained as part of the Netpbm family. It is used for storing black-and-white graphics, line art, icons, and intermediary image data in scripting, printing, and conversion workflows. PBM is a legacy format with minimal features, and files are generally safe, though untrusted images should still be handled by standard parsers.
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.