How to convert a GIF to Base64 on a Mac
You can do this with B64, on your own machine. Here is how, and why an animated GIF keeps animating after the round trip.
The question people ask about GIFs is always the same one: does the animation survive? It does. Every frame, the delay between them and the loop count are all part of the GIF file, and Base64 encodes the file rather than a picture of it.
This guide covers encoding a GIF in B64, where an embedded one earns its place, and the size question that comes with animation.
The conversion runs in the app, on your Mac. Nothing is uploaded and there is no account, so a picture that should not leave the building does not have to.
Encode a GIF
Open Encode
Click Encode in the sidebar or press ⌘1.
Load the GIF
Drag it from the Finder onto the Encode area, click Choose File… (⌘O), or press ⇧⌘V to encode a copy already on your clipboard.
Pick the output format
HTML gives you a finished
<img>tag, which is the usual destination for a GIF; Markdown is the one for a README with a demo loop in it.Copy or export
Copy (⇧⌘C) or Export… (⌘E).
The animation is in the bytes
A GIF is not a picture with an animation attached; it is a container holding a sequence of frames, a palette, per-frame delays and a loop count. B64 encodes the container. Nothing is flattened, no frame is chosen, and the string you get back decodes to the identical file.
The preview in the app shows you the first frame, which is how a still preview of an animation works everywhere. Decode the payload and save it and you get an animated GIF again, because you always had one.
Paste the encoded result into Decode — it is free — and save the image. Open the saved file and it plays. That is a complete round-trip test in under a minute.
Where an embedded GIF earns its place
- An email signature. A small animated mark that does not depend on a remote image being loaded, which many mail clients block by default.
- A README demo. A short screen recording as an inline Markdown image, so the repository carries its own demo.
- A single-file page. A self-contained demo or bug report that works from disk with no assets folder.
Size: animation costs frames
An animated GIF is as large as the sum of its frames, and Base64 adds a third on top. A three-second screen recording can easily be several megabytes before encoding, which becomes several more after.
The Inspector (⌥⌘I) shows the source size, the character count and the overhead. If the number is uncomfortable, the fix is upstream: fewer frames, fewer colours, or a smaller frame size in whatever produced the GIF.
Copying and exporting the result
Copy (⇧⌘C) puts the complete string on the clipboard. Export… (⌘E) writes it to a .txt file. Both always use the whole result, even when a long one is displayed in pages.
If you find yourself doing this often, turn on copy after encoding in B64 ▸ Settings… ▸ General. Dropping the file then is the whole interaction — the result is on your clipboard before you have reached for a shortcut.
Recognising a GIF payload
GIF Base64 starts R0lGODlh — those characters are the encoded form of GIF89a. A payload beginning that way is a GIF whatever its data URI claims, and B64 tells you the actual format rather than the advertised one.
Troubleshooting
The preview does not animate
A still preview shows a single frame; that is expected and says nothing about the data. Decode the payload, save it, and open the file to see it move.
The embedded GIF does not animate where I pasted it
Some consumers deliberately render only the first frame of an animation. That is a decision at the far end, not something in the payload — the same string will animate in a browser.
The payload is far bigger than the GIF looked
Check the source size in the Inspector. Screen recordings exported as GIF are routinely much larger than they appear, because every frame is a full image.
Frequently asked questions
Does Base64 break GIF animation?
No. Every frame, the timing and the loop count are part of the GIF file, and Base64 encodes the file. Decode the string and you have the same animated GIF back.
Why does the preview only show one frame?
A still preview shows a single frame by design. Decode the payload and save the file to see it animate.
Is an animated GIF data URI a good idea in an email?
For a small one, yes — it always displays, where a remote image is often blocked. For a long screen recording, the size makes it a poor trade.
Why does GIF Base64 start with R0lGODlh?
That is the encoded form of the GIF89a header every GIF begins with.