Skip to content

PPM (.ppm)

.ppm file signature | image/x-portable-pixmap

Portable Pixmapbinary

Safe

Magic Bytes

Offset 0
50 33

Sources: Apache Tika

All Known Signatures

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

Hex Signature Offset Sources
50 33 0 Apache Tika
50 33 0A 0 Wikipedia
50 36 0A 0 Wikipedia

Extension

.ppm

MIME Type

image/x-portable-pixmap

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .ppm files in Python

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

How to validate .ppm files in Node.js

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

How to validate .ppm files in Go

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

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .ppm file?

A .ppm file is a PPM file. Portable Pixmapbinary

What are the magic bytes for .ppm files?

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

How do I validate a .ppm file?

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

What is the MIME type for .ppm files?

The primary MIME type for .ppm files is image/x-portable-pixmap.

Is it safe to open .ppm files?

PPM (.ppm) 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.