file in abyss
Back to formats

Image

GIF Graphics Interchange Format

Graphics Interchange Format is a image format commonly identified by .gif. Use the listed signatures, MIME types, and structure notes to validate files beyond the extension.

Extensions .gif
MIME image/gif

Magic numbers

Analyze your file
offset 0 Graphics Interchange Format leading signature
47 49 46 38 37 61
GIF87a
offset 0 Graphics Interchange Format leading signature
47 49 46 38 39 61
GIF89a

Structure

  1. Header
  2. Logical screen descriptor
  3. Global color table
  4. Image blocks
  5. Trailer

Caveats

  • Do not trust the extension alone. Check the MIME type, the first bytes such as 47 49 46 38 37 61, and format-specific structure when possible.
  • Container formats and damaged files can share the same opening bytes, so deeper validation may be required for production upload, preview, or conversion flows.

Detection example

SIGNATURE = bytes.fromhex("474946383761")
OFFSET = 0

def is_gif(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

Practical usage

Use cases

Graphics Interchange Format is commonly used for image previews, thumbnails, metadata checks, and upload validation. Test multiple sizes because resolution, alpha support, compression, and file size often affect implementation behavior.

Common detection mistakes

  • The .gif extension alone does not prove the file contents. Upload and conversion flows should combine extension, MIME type, leading bytes, and format-specific structure checks.
  • Graphics Interchange Format can start with signatures such as 47 49 46 38 37 61 or 47 49 46 38 39 61, but related containers and damaged files may require additional validation.

Security notes

Media files can still stress decoders through corrupt metadata, extreme dimensions, long durations, or unusual chunks. Read size, dimensions, and duration before processing.

Using samples

11 samples help test tiny images, high-resolution images, alpha channels, and hard-to-compress assets.

Sample files

11 / 11 files
Sample Traits Size Source / license / SHA-256
1x1 GIF preview

1x1 GIF

1x1 GIF is a Graphics Interchange Format sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

1x1.gif
Type Sample
Small file
43 B
Generated CC0 1.0
SHA-256 b1442e85b03bdcaf66dc58c7abb98745dd2687d86350be9a298a1d9382ac849b
Download
Blue Sky GIF preview

Blue Sky GIF

Blue Sky GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 96 x 72. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.gif
Resolution 96 x 72 7 Kpx
Preview
3.6 KB
SHA-256 4fe4554fb7eb8920681a37b43035b8cd6cdb94869ccbbca60d484b47e9371e1d
Download
Flower Garden GIF preview

Flower Garden GIF

Flower Garden GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 160 x 90. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.gif
Resolution 160 x 90 14 Kpx
Preview
8.3 KB
SHA-256 eb1da0c8aec6b337ab6abc292a3cda4c8569a39d7e69bf57c16861e6f20315af
Download
Navy Blue Sky GIF preview

Navy Blue Sky GIF

Navy Blue Sky GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 256 x 128. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.gif
Resolution 256 x 128 33 Kpx
Preview
8.8 KB
SHA-256 dd308bc7618cc18f8e98e88125947ce91e33cd64ea848fd4aa576f3da7a3a1bd
Download
Nature of the Sky GIF preview

Nature of the Sky GIF

Nature of the Sky GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 360 x 270. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.gif
Resolution 360 x 270 97 Kpx
Preview
17 KB
SHA-256 c6887346eeaf19a2072aa65bcb1b70ef5891913e4fc78e5be85e3e124803876b
Download
Sky Landscape GIF preview

Sky Landscape GIF

Sky Landscape GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 512 x 384. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.gif
Resolution 512 x 384 197 Kpx
Preview
48 KB
SHA-256 d4a52af9bb7c49d41ff42926b4708c698a9e03303d33df6a750787b2ebcab072
Download
Starry Sky GIF preview

Starry Sky GIF

Starry Sky GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 720 x 480. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.gif
Resolution 720 x 480 346 Kpx
Preview
86 KB
SHA-256 dc373d7e797e546a709403ad8b648f630f1c2e78fb1dbc78247527789c6a0f99
Download
Blue Night Sky GIF preview

Blue Night Sky GIF

Blue Night Sky GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 960 x 640. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.gif
Resolution 960 x 640 614 Kpx
Preview
277 KB
SHA-256 ad72a17789fbe7f26e9691fd6355e3672c4f7d2ba7d8dbd2d0a2942eb5d3fa7b
Download
Hibiscus Flower GIF preview

Hibiscus Flower GIF

Hibiscus Flower GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 1280 x 2770. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.gif
Resolution 1280 x 2770 3.5 MP
High resLarge file
1.34 MB
SHA-256 1284d2d2ae1365187adee386b5630766fb5452e2f61189342888b5adddf42065
Download
Arctic Sky GIF preview

Arctic Sky GIF

Arctic Sky GIF is a Graphics Interchange Format sample based on Wikimedia Commons, 1600 x 1062. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.gif
Resolution 1600 x 1062 1.7 MP
Preview
625 KB
SHA-256 8c3e6a7a91f978f524a5b885c955ad22b912c71e62f7e6119a2b133c46499fd7
Download
NASA Blue Marble GIF preview

NASA Blue Marble GIF

NASA Blue Marble GIF is a Graphics Interchange Format sample based on NASA Image and Video Library, 640 x 640. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.gif
Resolution 640 x 640 410 Kpx
Preview
112 KB
SHA-256 102a04cf58beec5478958cc4d88bf5b2ddd21d19aef22a2f3b67bb2e3f4f0760
Download

Frequently asked questions

What is the magic number (file signature) of Graphics Interchange Format?

Graphics Interchange Format files begin with the byte signature 47 49 46 38 37 61 ("GIF87a") or 47 49 46 38 39 61 ("GIF89a"). Detect the format by reading these leading bytes rather than trusting the file extension alone.

What is the MIME type of Graphics Interchange Format?

The MIME type for Graphics Interchange Format is image/gif.

What file extension does Graphics Interchange Format use?

Graphics Interchange Format files use the .gif extension. The extension is a convention only and does not guarantee the file contents, so combine it with signature and structure checks.

Related formats