File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Images
  • Raster
  • Vector
  • Camera raw
  • Layered projects
  • HDR & scientific
  • Icons
  • Retro
  1. Home
  2. Images
  3. Raster
  4. GIF
.GIF
  • Overview

.GIF

Graphics Interchange Format

Introduction

GIF was introduced by CompuServe in 1987 (version 87a) and extended in 1989 (version 89a). Each frame holds up to 256 colours from a palette, compressed without loss using LZW. Version 89a added transparency, frame delays and comments, which together made GIF the format for short looping animations on the web.

The LZW patent held by Unisys led to the creation of PNG in the 1990s. The patent expired in 2003 and 2004, and GIF remains widely supported.

Software

  • GIMP (Windows, macOS, Linux)
  • Adobe Photoshop (Windows, macOS)
  • Photopea (web browser)
  • Ezgif (web browser)
  • Gifsicle (Windows, macOS, Linux)
  • ImageMagick (Windows, macOS, Linux)
  • IrfanView (Windows)
  • XnView MP (Windows, macOS, Linux)

Structure

A GIF starts with a 6-byte header, GIF87a or GIF89a, and a 7-byte logical screen descriptor giving the canvas size (little-endian) and whether a global colour table follows. The rest of the file is a series of blocks, each introduced by one byte: 21 for an extension, 2C for an image and 3B for the trailer that ends the file.

An image block has a 10-byte descriptor, an optional local colour table, the LZW minimum code size and the compressed data. Image data and extension data are written as sub-blocks: a length byte of up to 255 followed by that many bytes, ending with a zero-length sub-block. A graphic control extension before an image sets its delay and transparent colour, and the NETSCAPE2.0 application extension sets the loop count.

  1. 0Header GIF89a6 bytes
  2. 6Logical screen descriptor width, height, flags, background colour7 bytes
  3. 13Global colour table 3 bytes per colour, optional6 to 768 bytes
  4. …Frames repeated for each imagevaries
    1. 21 F9Graphic control extension delay, transparency, disposal8 bytes
    2. 2CImage descriptor position, size, flags10 bytes
    3. …Local colour table optional, then the LZW data sub-blocksvaries
  5. …Trailer 3B1 byte
A GIF file: header, screen, colours, frames and trailer
© 2026 fileformats.org About Contact Made by Lewpen