What is a GIF? A short guide to the file, with real measurements
GIF stands for Graphics Interchange Format. It is a picture file that can hold one image or a sequence of frames, which is how it animates. According to the GIF89a specification, each frame uses a colour table of at most 256 colours, and each frame has its own delay in hundredths of a second. The sections below open a real GIF and measure why GIFs look grainy and big.
By Kevin Fan ·
How a GIF file is built
The specification says a GIF starts with a header that names the version, 87a (May 1987) or 89a (July 1989), and that 89a extends 87a. The delay between frames and the extension blocks need 89a. We opened a GIF that LoopGIF wrote, 30 frames at 320 × 240 pixels, and read its bytes. The header says GIF89a.
Next come the screen size and a global colour table of 256 entries. Then 30 frames follow, each with a delay of 10 centiseconds, so 300 centiseconds, or 3 seconds, in all. The delay is stored in hundredths of a second, so 100 ms is 10 cs. None of the frames carries a colour table of its own.
| Part of the file | Value we read |
|---|---|
| Header | GIF89a |
| Screen size | 320 × 240 px |
| Global colour table | 256 entries |
| Frames and delay | 30 frames, 10 cs each |
| Loop block | NETSCAPE2.0, repeat count 0 |
| File size | 810,387 bytes |
The last piece is the loop. The file has a NETSCAPE2.0 application extension with a repeat count of 0, which means play forever. The specification defines application extensions in general but does not mention looping, so this block is a convention that apps read. Every frame is marked disposal method 1, which the specification calls do not dispose.
Why GIFs look grainy: the 256-colour palette
A colour table holds 2 to the power of (the size field + 1) entries, according to the specification, so it tops out at 256. A photo has far more colours, so the encoder picks a palette and maps every pixel to the nearest entry, and smooth gradients turn into bands. Our encoder uses at most 255, which leaves one entry free for transparency.
The same frame is shown below as one-frame GIFs at 255, 127, 63 and 15 colours: 51,903, 41,342, 29,168 and 12,543 bytes. Fewer colours make a smaller file and more visible bands. The whole 3-second clip went from 1,599,805 bytes at 255 colours to 469,323 bytes at 15.
255 colours
127 colours
63 colours
15 coloursWhy GIFs are big: every frame is stored
GIF image data is compressed with LZW, a lossless method with codes of up to 12 bits, according to the specification. Each frame has its own data stream, so the file grows with the number of frames and with the number of pixels in each. A frame can reuse the one before only by covering a smaller rectangle, which the image descriptor allows, or by marking unchanged pixels transparent and leaving the old frame in place.
We measured both effects on the same photo clip. Trimmed to 10, 20 and 30 frames at 480 px, it took 551,241, 1,003,500 and 1,599,805 bytes. At 30 frames and four widths, the file grew from 162,526 bytes at 120 px to 1,599,805 bytes at 480 px. In this clip every pixel changes as the picture zooms, so the unchanged-pixel trick saves little.
| Frames (seconds) | Bytes |
|---|---|
| 10 (1) | 551,241 |
| 20 (2) | 1,003,500 |
| 30 (3) | 1,599,805 |
| Width and height | Bytes |
|---|---|
| 120 × 90 px | 162,526 |
| 240 × 180 px | 504,041 |
| 360 × 270 px | 991,572 |
| 480 × 360 px | 1,599,805 |
Transparency in a GIF is on or off
The Graphic Control Extension holds a transparency flag and one colour index to treat as transparent, according to the specification. A pixel is therefore either clear or fully opaque. A cutout with soft edges has to be flattened onto a matte colour before it is written, which is why a GIF maker asks you for a matte colour.
In one frame of our dance sticker, the cutout leaves 746 partly transparent pixels, and 66,531 fully clear ones. A GIF cannot store the partly transparent ones. We wrote the same sticker with a white matte (311,232 bytes) and a dark matte (311,232 bytes), the same byte count though the files differ, and show both on a dark background. The transparent GIF maker lets you choose the matte.
White matte
Dark matteGIF vs MP4 vs WebP vs APNG: measured bytes for the same clip
We turned the same 30 frames of our photo clip, 480 × 360 px, 3 seconds at 10 frames per second, into four formats. The GIF is the one our encoder writes. The others are one encoder at one setting each, so another setting gives another size. This is a comparison for one clip, not a rule. The MP4 and WebP were encoded in Node with the settings in the table, not in your browser, so the browser converters can give other sizes.
| Format | Bytes | Compared with the GIF | How it was made |
|---|---|---|---|
| GIF | 1,599,805 | the base | LoopGIF encoder, 255 colours |
| MP4 | 55,275 | 28.94 times smaller | H.264, CRF 23, one thread |
| Animated WebP | 250,622 | 6.38 times smaller | Animated WebP, quality 80 |
| APNG | 5,422,248 | 3.39 times larger | Lossless, LoopGIF APNG writer |
The MP4 is 55,275 bytes, 28.94 times smaller than the 1,599,805 byte GIF, and the WebP is 250,622 bytes, 6.38 times smaller. The APNG is 5,422,248 bytes, 3.39 times larger, because it keeps every pixel exactly. The GIF to MP4 and GIF to WebP converters show the GIF's size next to the new file's before you download it.
When a GIF is still the right choice
Choose the format the destination asks for. Discord's developer documentation lists GIF among its emoji upload formats, next to PNG, JPEG, WebP and AVIF, so a GIF is a valid emoji, and our Discord emoji size guide shows how to fit one under its limit.
Microsoft's Outlook help says animated GIFs can be added to a message, which our email guide covers. If you only need to show a clip somewhere you control, the MP4 and WebP from this clip were 28.94 and 6.38 times smaller. For a loop that does not jump, see the seamless loop GIF guide.
Make or convert a GIF with LoopGIF
- Start from a clip with video to GIF: drop a video, trim it, and set the frame rate and width.
- Shrink a GIF you already have with the GIF compressor, which shows the exact settings it used.
- Compare formats with GIF to MP4 or GIF to WebP, which show both file sizes before you download.
- Browse every tool in the free GIF tools list. All the free tools run in your browser.
How we checked this page
We read the W3C's GIF89a specification on 18 Nov 2026. Every number above was measured on one of our own photos with LoopGIF's own code, and the header, delays and loop block were read from the bytes of a file our encoder wrote. We did not take figures for other tools or sites, and the format comparison is for this one clip. See all LoopGIF guides for more.
Questions, answered
What does GIF stand for?
Graphics Interchange Format, the title of the GIF89a specification on the W3C site. The specification covers versions 87a and 89a, and says the extension blocks need 89a.
How many colours can a GIF have?
A colour table has at most 256 entries, according to the specification, and each frame can carry its own table. The LoopGIF encoder writes one global table and uses at most 255 colours, so one entry stays free for transparency.
Is a GIF a video?
No. A GIF is a picture file with a list of frames, each with its own delay in hundredths of a second. It has no video codec. When we converted the same 30 frames to MP4, the video was 28.94 times smaller, which shows how different the two are inside.
Why are GIF files so big?
Each frame is stored as its own LZW-compressed image. In our photo clip, 10 frames took 551,241 bytes and 30 frames took 1,599,805 bytes at 480 px. Width matters too: 120 px took 162,526 bytes and 480 px took 1,599,805 bytes with 30 frames.
Can a GIF be transparent?
Yes, but only on or off. The specification gives a frame one transparent colour index, so a pixel is clear or opaque, with no soft edge. A cutout is flattened onto a matte colour before the file is written. The transparent GIF maker lets you choose that matte colour.
Is GIF better than MP4?
On file size, no, at least for our clip: the MP4 was 55,275 bytes and the GIF 1,599,805. Which is better depends on where the file is going, and some places name the formats they accept, as Discord's documentation does. We measured one clip at one setting, so treat the ratio as an example.