Skip to content

Graphics interchange format fileTrailer:00 3B (.gif)

.gif file signature | image/gif

Image file encoded in theGraphics Interchange Format(GIF)[9]

Safe

Magic Bytes

Offset 0
47 49 46 38 37 61

Sources: Apache Tika, Gary Kessler

All Known Signatures

4 signature variants are documented for .gif files across multiple sources.

Hex Signature Offset Sources
47 49 46 38 37 61 0 Apache Tika, Gary Kessler
47 49 46 38 39 61 0 Apache Tika, Gary Kessler
47 49 46 38 37 61 47 49 46 38 39 61 0 Wikipedia
47 49 46 38 0 Neil Harvey FileSignatures

Extension

.gif

MIME Type

image/gif

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .gif files in Python

Python
def is_gif(file_path: str) -> bool:
    """Check if file is a valid GIF by magic bytes."""
    signature = bytes([0x47, 0x49, 0x46, 0x38, 0x37, 0x61])
    with open(file_path, "rb") as f:
        return f.read(6) == signature

How to validate .gif files in Node.js

Node.js
function isGIF(buffer: Buffer): boolean {
  const signature = Buffer.from([0x47, 0x49, 0x46, 0x38, 0x37, 0x61]);
  return buffer.subarray(0, 6).equals(signature);
}

How to validate .gif files in Go

Go
func IsGIF(data []byte) bool {
    signature := []byte{0x47, 0x49, 0x46, 0x38, 0x37, 0x61}
    if len(data) < 6 {
        return false
    }
    return bytes.Equal(data[:6], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .gif file?

A .gif file is a Graphics interchange format fileTrailer:00 3B file. Image file encoded in theGraphics Interchange Format(GIF)[9]

What are the magic bytes for .gif files?

The magic bytes for Graphics interchange format fileTrailer:00 3B files are 47 49 46 38 37 61 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .gif file?

To validate a .gif file, read the first bytes of the file and compare them against the known magic bytes (47 49 46 38 37 61) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .gif files?

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

Is it safe to open .gif files?

Graphics interchange format fileTrailer:00 3B (.gif) 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.