Loading Base64 to Image Converter...

How to Convert Base64 to a GIF Image

GIFs travel as Base64 more often than you might think: loading spinners inlined into CSS, reaction GIFs stored by chat bots, little icons in email signatures, and the 1 pixel spacer that still hides in a lot of HTML. Paste the string below to see what it is and get the real file back.

Step 1

Paste the Base64 string

Paste the string into the input panel, or upload a .txt file that contains it. A data:image/gif;base64, prefix, line breaks and URL-safe Base64 are all accepted.

•
Spot a GIF quickly: a Base64 GIF begins with R0lGODlh (or R0lGODdh for very old files), which is just GIF89a written in Base64.
•
Copied from CSS or HTML: you can keep the data:image/gif;base64, part; it is stripped before decoding. Leave out the surrounding url(...) or quotes.
•
About the Sample button: it loads a small PNG, not a GIF, so you can see that the page labels a file by what it really is.
Step 2

Look at the preview

A moment after you paste, the string is decoded and the GIF appears in the preview, animated if the file is animated. The Format line tells you what the header says the file really is.

•
Animation: the preview is your browser showing the decoded file, so an animated GIF loops just as it would on a web page.
•
A bad character: if something in the string is not Base64, the error tells you the line and column where it sits.
•
Not an image after all: if the bytes turn out to be text, a PDF or an archive, the page tells you. Base64 to File can save any kind of data.

What is inside a GIF

A six-byte signature, the canvas size, a colour table of up to 256 colours, and then one block per frame with its own delay and an optional transparent colour. A looping animation also carries a small application block that says how many times to repeat. The GIF89a specification describes every block, and Base64 itself is defined in RFC 4648.

Step 3

Download the GIF

Click Download to save the decoded bytes as a .gif file. On wider screens you can type your own file name before saving.

•
Same file as before: the download is byte for byte what was encoded, so it opens in any image viewer, chat app or editor that took the original.
•
Next one: click Clear and paste the next string.
•
Need more colours: GIF tops out at 256 colours per frame, so photos tend to look grainy. Base64 to PNG and Base64 to Image use the same decoder for other formats.

Frequently Asked Questions

How do I know a Base64 string holds a GIF?

Every GIF file starts with GIF89a or the older GIF87a, and in Base64 that shows up as R0lGODlh or R0lGODdh at the very beginning. You do not have to check by eye, though: the page reads the decoded header and prints the format it found next to the preview.

Will an animated GIF still move after decoding?

Yes. The page does not redraw or re-save the image. The bytes you download are the bytes that were encoded, so every frame, the delay between frames and the loop count come back unchanged, and the preview plays the animation the way your browser normally would.

What happens to the transparent parts?

They stay transparent. A GIF marks one colour in its palette as see-through, and that setting is part of the file, so it survives the trip through Base64. In the preview you will see the page background through those pixels.

I pasted the string and it says PNG, not GIF. Is something wrong?

Not with the page. It names the format the bytes really are, and the download gets the matching extension, so a PNG is saved as .png even here. Nothing is converted between formats. The Sample button is a good example: it loads a small PNG on purpose.

What is that tiny R0lGODlhAQABAIAAA... string I keep seeing in HTML and emails?

That is almost always a 1 by 1 transparent GIF, the classic spacer or tracking pixel. Paste it here and you will get a 42 or 43 byte file showing a single invisible pixel. It is harmless on its own, but in emails it is often used to tell the sender that the message was opened.

Is the Base64 sent to your server?

No. Decoding happens in JavaScript inside your browser, and the preview and the download are built on your own machine. Nothing is uploaded and nothing is kept, so a reload starts with an empty editor.

How do I get Base64 from a GIF file?

Go the other way with the GIF to Base64 page: pick the .gif there and copy the string it gives you. Decoding that string on this page returns the identical file.

Related pages: GIF to Base64 · Base64 to PNG · Base64 to File