GIF

What is a GIF file?

Limited to 256 colours, but the only image format everything animates. Large files for video-like content.

What GIF is

GIF is a binary format, meaningful only to a program that knows it. It stores a grid of pixels, so enlarging it past its own resolution softens it. It is used for the web.

The extension is .gif, and the full name is Graphics Interchange Format. Both matter less than what the file can hold, which is what the rest of this page is about.

Where GIF came from

CompuServe published it in 1987. The specification is GIF89a.

A format that has been readable for that long is a format worth trusting with something you want back in ten years.

The specification is public

It is published in full, so anyone can implement it from the document rather than by inspection, which is why it turns up in so many programs and why files written twenty years ago still open. A published specification is not the same thing as a royalty-free one: where a format wraps a codec, the patent licensing is a separate question the standard does not settle.

It is a legacy format

It still opens everywhere and is still written by older tools, but nothing new is being built around it. Convert what you mean to keep, and do not choose it for something starting today.

Nothing is thrown away

GIF stores its content exactly. Saving it again changes nothing, so it can be opened, edited and re-saved as often as you like without accumulating damage — which is what makes it a working format rather than a delivery one.

It can be transparent

GIF carries an alpha channel, so a logo keeps its soft edges over whatever sits behind it instead of arriving in a white box.

It can hold more than one frame

GIF can store an animation rather than a single still. That is worth knowing before converting one: a target that holds one frame keeps the first and drops the rest, usually without saying so.

Colour it can describe

Up to 8 bits per channel. It can work in an indexed palette.

Eight bits per channel is what a screen shows and what nearly every delivery format carries.

GIF is limited to 256 colours

The palette is the constraint everything else follows from. A photograph converted into it has to have its colours chosen and approximated, which is why gradients come out in bands or speckles, and why flat-coloured artwork survives it perfectly.

There is a size limit worth knowing

GIF cannot describe an image larger than 65,535 pixels on a side. That is far beyond an ordinary photograph and well within reach of a stitched panorama or a high-resolution scan, which is exactly when people meet it.

What opens GIF

GIMP, Adobe Photoshop and ImageMagick read it, and so do most programs of the same kind.

If a file will not open, the format is rarely the problem — it is more often that the program predates it. Converting to something older is the reliable way past that, and it is what the rest of this site is for.

Opening it in a browser

Every current browser reads it.

That makes it a safe thing to put on a page or attach to a message without wondering what the other end has installed.

It is a delivery format

GIF is meant to be handed over rather than worked in. Editing one is possible and rarely pleasant; the sane approach is to change the source and export again.

What goes wrong with it

The recurring complaints: smooth gradients can come out in visible steps.

None of these is a reason to avoid the format. They are the things worth knowing before you are surprised by one, which is a different claim and a more useful one.

Two hundred and fifty-six colours, and everything follows

A GIF stores a palette of at most 256 colours and then refers to it by index. Every pixel is a number pointing at a table entry. That was a sensible design in 1987, when displays could show 256 colours and a palette was how images worked.

Every complaint about GIF traces back to it. A photograph has far more than 256 distinct colours, so converting one means discarding almost all of them — which is why skies band into visible steps and why skin tones go blotchy. The format is not doing this badly; it is doing exactly what it was designed to do, on content it was never designed for.

Dithering trades banding for speckle

Faced with a gradient it cannot represent, an encoder can dither: scatter pixels of the two nearest available colours so the eye blends them. It genuinely works, and it is why a well-made GIF of a photograph looks better than the palette should allow.

The cost is visible up close as a fine grain, and it is expensive. Dithering destroys the runs of identical pixels that GIF’s compression depends on, so a dithered GIF is frequently much larger than an undithered one. That trade — smoother gradients against a bigger file — is the main lever anyone has when making one.

Animation is why it survived

GIF animates without being a video, and it does so in more places than APNG or animated WebP reach — chat clients, email, forum software, presentation tools and a great deal of software that never learned a second animated format. That reach has carried it for forty years. It needs no player, no codec negotiation and no autoplay permission — it is an image, and everything that displays images displays it moving.

That is a social fact more than a technical one. Chat applications, forums, issue trackers and messaging platforms accept an animated GIF and frequently refuse an animated WebP or APNG, both of which are better in every measurable respect. The format persists because of where it is accepted, not because of what it does.

A five-second clip becomes an enormous file

Each frame is stored as an image, compressed only against itself and its neighbours in a limited way. Video codecs describe what changed between frames; GIF largely does not. So five seconds of a person moving at any real size produces a file of several megabytes, where the same clip as MP4 is a couple of hundred kilobytes.

The practical levers are resolution, frame rate and length, in that order. Dropping the width to around 480 pixels and the rate to 10 or 12 frames per second usually brings a clip into a sendable size. If the destination accepts video at all, it remains the better answer by a wide margin.

Transparency is one bit, with no in-between

A GIF can mark one palette entry as transparent, and that is the whole mechanism. A pixel is either fully opaque or fully invisible — there are no partial values.

The visible result is jagged edges on anything curved, and a halo of the old background colour around a subject that was cut out against something else. PNG solved this in 1996 with a proper alpha channel, and it is the single strongest reason to use PNG for a logo or an icon rather than GIF.

The patent fight that produced PNG

GIF’s compression uses LZW, which Unisys held patents on. In 1994 the company began enforcing them against software that wrote GIFs, and a format everybody had been using freely suddenly required a licence.

The response was PNG, designed in the open over the following months specifically to be unencumbered, and it arrived better in almost every way. The patents ran out between 2003 and 2006 — the US one first, its European, Japanese and Canadian counterparts in 2004, IBM’s last — and the dispute became history. By then GIF had already lost the still-image argument permanently, and kept only the animation.

Loops, timing and the frames that stall

Each frame carries its own delay, so a GIF can hold a long pause on one image and race through others. The loop count lives in an extension block, with zero meaning forever, which is what almost every GIF specifies.

A delay of 0 or 1 hundredths of a second is where behaviour diverges: browsers historically clamped very short delays to a minimum, so a GIF authored at 100 frames per second plays at roughly ten in some viewers and faster in others. If an animation runs at visibly different speeds in different places, that clamping is usually why.

It is pronounced both ways and neither side will win

Steve Wilhite, who led the team that created it at CompuServe, said it was pronounced with a soft G — "jif" — and reiterated it when accepting a lifetime achievement award in 2013. The hard G remains overwhelmingly more common in practice.

It is included here because people genuinely search for it, and because the honest answer is that the creator’s intent and general usage disagree, which is an ordinary outcome for a word that spread faster than anyone could correct it.

What to convert it to

For a still image, PNG — lossless, full colour, proper transparency, and usually smaller than the GIF. For an animation going somewhere that accepts video, MP4 or WebM, which will be a fraction of the size at better quality. For an animation that must remain an image, WebP where the destination supports it.

Convert to GIF only when the destination specifically wants one, which is a real and common case: a chat window, an issue thread, a documentation page, a platform whose upload form has not changed in a decade. The format is worse than its replacements and better accepted, and that is the whole calculation.

The facts, in one place

Identifiers and provenance for the GIF format.
Extension.gif
Media typeimage/gif
Published byCompuServe
First published1987
SpecificationGIF89a

Where these figures come from

The claims on this page are checkable, and these are the documents that settle them.