GIF to Base64

Encode animated or static GIFs as Base64 data URIs.

Drag & drop a file here, or click to browse

Drop a static or animated GIF here. Max 10 MB, converted in your browser.

GIF to Base64 Converter

Turn a static or animated GIF into a Base64 string or a data:image/gif;base64,... URI. Drop your file above and you'll see the animation playing in the preview, plus the encoded size and ready-made HTML, CSS, Markdown, and JSON snippets.

About the GIF format

CompuServe introduced GIF (Graphics Interchange Format) in 1987, and the GIF89a revision from 1989 added the features it's famous for: multiple frames with individual delays, a loop extension, and one fully transparent color. GIF uses LZW compression on an indexed palette of up to 256 colors. That keeps simple graphics small, but photos look posterized or dithered. Transparency is binary — each pixel is either fully visible or fully clear, with no soft edges. Every browser and email client ever made supports GIF, including Outlook, which is why it remains popular for animated email content.

Animation is preserved

Base64 doesn't touch the image data, so animated GIFs stay animated. The data URI can be dropped into an <img> tag or a CSS background-image and the browser plays every frame. The output begins with data:image/gif;base64,R0lGODlh, the encoded form of GIF89a.

Keep an eye on size

Animated GIFs grow fast because every frame is a full palette image. A 3-second clip can easily be 1–2 MB, which becomes 1.3–2.7 MB of Base64 text — too large to inline. Good candidates are:

  • Loading spinners and small UI animations under ~10 KB.
  • The famous 1×1 transparent spacer or tracking pixel.
  • Tiny animated icons in HTML emails where external images are blocked by default.

For bigger animations, animated WebP or a short MP4 is far smaller. See WebP to Base64 or APNG to Base64 for animated formats with full alpha. To inspect an existing GIF string, paste it into Base64 to Image.

Frequently Asked Questions

Yes. All frames, delays, and the loop count are stored in the file, and Base64 keeps every byte. When a browser loads the data:image/gif;base64,... URI it plays the animation exactly like the original file.

A 1×1 transparent GIF is only 42 bytes, which gives data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7. It's a classic placeholder for lazy-loaded images and spacer elements.

GIF files begin with the ASCII header GIF89a or GIF87a. In Base64 these become R0lGODlh and R0lGODdh. GIF89a is the newer version that supports transparency, animation, and comments.