50

Netpbm (PPM/PGM/PBM) file signature

Magic number at the start of the file · P6

50 36

The Netpbm formats start with the letter P and a digit 1 to 6 that picks the exact type: P6 is a binary colour PPM, P5 a grayscale PGM, P4 a bitmap PBM.

Hex signature
50 36
Offset
0 (start of file)
ASCII
P6
Length
2 bytes

What this magic number means

A magic number is a short, fixed run of bytes at a known position that tells a program what a file really is, no matter what the filename says. If a file starts with the bytes 50 36 (the text P6), it is a Netpbm (PPM/PGM/PBM) file.

Signature variants

Netpbm (PPM/PGM/PBM) appears with more than one byte pattern. These all identify the same family:

Hex signatureOffsetNote
50 310P1, ASCII bitmap (PBM)
50 340P4, binary bitmap (PBM)
50 350P5, binary grayscale (PGM)
50 360P6, binary colour (PPM)

Formats that use the 50 36 signature

These file types in our database carry this signature:

How to check a file's signature

You can read the first bytes of any file yourself. The magic bytes are shown in hex, the same way this page lists them.

Linux & macOS

  • xxd -l 16 example.ppm
  • hexdump -C -n 16 example.ppm
  • file example.ppm

Windows (PowerShell)

  • Format-Hex -Path example.ppm -Count 16

Python

  • open("example.ppm","rb").read(2).hex()

In your browser

Frequently asked questions

What is the Netpbm (PPM/PGM/PBM) file signature?

Netpbm (PPM/PGM/PBM) files start with the hex bytes 50 36 (P6 in ASCII). This magic number identifies the format regardless of the file's name or extension.

How do I check a file's magic number?

Open the file in a hex editor, or run a command such as xxd -l 16 example.ppm on Linux or macOS, or Format-Hex -Path example.ppm -Count 16 in Windows PowerShell, and read the first bytes.

Can a file fake the Netpbm (PPM/PGM/PBM) signature?

Renaming a file does not change its bytes, so the extension can lie but the signature usually cannot. A genuine Netpbm (PPM/PGM/PBM) file has these exact bytes; a file with the wrong bytes is not really Netpbm (PPM/PGM/PBM), whatever its name says.

Related signatures

Sources