What is the largest repeat count supported by GIF's Netscape Application Block?

The story behind the answer

The largest repeat count supported by GIF’s Netscape Application Block is 65535.

The loop field in the NETSCAPE2.0 Application Extension is an unsigned 16-bit integer, so its finite values span 1 through 65535. The upper limit follows directly from the field’s width: 16 binary bits can represent 65,536 combinations, from 0 to 65,535. Zero is assigned a special meaning—loop forever—leaving 65535 as the largest finite repeat value.

The count is stored in little-endian order, meaning the low byte comes first. The maximum therefore appears as the two bytes FF FF. This is distinct from the one-byte sub-block length fields elsewhere in GIF, whose maximum is only 255; confusing those fields produces the tempting but incorrect answer 255.

The looping mechanism was Netscape’s application-specific extension rather than part of the original core GIF89a structure. It became broadly interoperable through browser and graphics-software support. A decoder that does not understand the extension can still parse the surrounding GIF data, but it may ignore the requested looping behavior.

Source: Wikipedia · fact-checked Sept. 2026

Add question to a list

Choose a list to keep this question in: