In GIF structure, what byte value signals the trailer at the end of the file?

The story behind the answer

In GIF structure, the byte value 0x3B signals the trailer at the end of the file.

The trailer is a one-byte termination marker. In ASCII, hexadecimal 0x3B represents the semicolon character (`;`), which normally appears as the final byte of a complete GIF data stream. A decoder uses it to recognize that no more image, extension, or other data blocks follow.

GIF files are organized as a header, a Logical Screen Descriptor, optional color tables, and a sequence of image or extension blocks. Those blocks use sentinel bytes: 0x2C (comma) introduces an Image Descriptor, while 0x21 (exclamation point) introduces an extension block. The trailer’s 0x3B is therefore easy to confuse with the other structural markers.

The marker does not itself store pixels or indicate a particular image format version. GIF87a and GIF89a streams both use the same trailer convention. If a file is truncated before 0x3B, some software may still recover an image, but the stream is technically incomplete or malformed.

Source: Wikipedia · fact-checked Sept. 2026

Add question to a list

Choose a list to keep this question in: