Skip to content

Portable Network Graphics fileTrailer:49 45 4E 44 AE 42 60 82 (.png)

.png file signature | image/png

Portable Network Graphics fileTrailer:49 45 4E 44 AE 42 60 82(IEND®B`‚...)

Safe

Magic Bytes

Offset 0
89 50 4E 47 0D 0A 1A 0A

Sources: Apache Tika, Wikipedia, Gary Kessler, Neil Harvey FileSignatures

All Known Signatures

2 signature variants are documented for .png files across multiple sources.

Hex Signature Offset Sources
89 50 4E 47 0D 0A 1A 0A 0 Apache Tika, Wikipedia, Gary Kessler, Neil Harvey FileSignatures
86 DD 0 Gary Kessler

Extension

.png

MIME Type

image/png

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .png files in Python

Python
def is_png(file_path: str) -> bool:
    """Check if file is a valid PNG by magic bytes."""
    signature = bytes([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .png files in Node.js

Node.js
function isPNG(buffer: Buffer): boolean {
  const signature = Buffer.from([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]);
  return buffer.subarray(0, 8).equals(signature);
}

How to validate .png files in Go

Go
func IsPNG(data []byte) bool {
    signature := []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .png file?

A .png file is a Portable Network Graphics fileTrailer:49 45 4E 44 AE 42 60 82 file. Portable Network Graphics fileTrailer:49 45 4E 44 AE 42 60 82(IEND®B`‚...)

What are the magic bytes for .png files?

The magic bytes for Portable Network Graphics fileTrailer:49 45 4E 44 AE 42 60 82 files are 89 50 4E 47 0D 0A 1A 0A at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .png file?

To validate a .png file, read the first bytes of the file and compare them against the known magic bytes (89 50 4E 47 0D 0A 1A 0A) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .png files?

The primary MIME type for .png files is image/png.

Is it safe to open .png files?

Portable Network Graphics fileTrailer:49 45 4E 44 AE 42 60 82 (.png) 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.