A virtual teacher who reveals to you the great secrets of Base64

GIF to Base64

Convert GIF to Base64 online and use it as a generator, which provides ready-made examples for data URI, img src, CSS background-url, and others. The GIF to Base64 converter is identical to Image to Base64, with the only difference that it forces the mime type to be “image/gif” (even if the uploaded file has a different content type or it cannot be detected). Please note that the GIF to Base64 encoder accepts any images types with a size of up to 50 MB. If you are looking for the reverse process, check Base64 to GIF.


How to convert GIF to Base64 online

  1. Choose the source of image from the “Datatype” field.
  2. Paste the URL or select a GIF image from your computer.
  3. If necessary, select the desired output format.
  4. Press the “Encode GIF to Base64” button.
  5. Download or copy the result from the “Base64” field.

About GIF

  • Name: Graphics Interchange Format
  • Developer: CompuServe
  • MIME types: image/gif
  • File Extensions: .gif
  • Uniform Type Identifier: com.compuserve.gif
  • Type of Format: Lossless bitmap image

Output formats

If you do not know what output format you need, check the following examples to see how will look the result of the same Base64-encoded GIF image formatted in each of the available formats (as an example image I use a one-pixel red dot GIF file):

Plain text:
R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=
Data URI:
data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=
CSS Background Image:
.base64 {
  background-image: url("data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=")
}
HTML Favicon:
<link rel="shortcut icon" href="data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=" />
HTML Hyperlink:
<a href="data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs="></a>
HTML Image:
<img alt="" src="data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=" />
HTML Iframe:
<iframe src="data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=">
  The “iframe” tag is not supported by your browser.
</iframe>
JavaScript Image:
var img = new Image();
img.src = "data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=";
document.body.appendChild(img);
JavaScript Popup:
window.onclick = function () {
  this.open("data:image/gif;base64,R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=");
};
JSON:
{
  "image": {
    "mime": "image/gif",
    "data": "R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs="
  }
}
XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <image mime="image/gif">R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs=</image>
</root>

If I missed an important output format for Base64-encoded GIF images, please let me know — I would love to implement it.

Comments (6)

I hope you enjoy this discussion. In any case, I ask you to join it.

  • georgi,
    All the best
  • Elias,
    Esto es una prueba
  • Jerome,
    Love your work! Thank you so much!
  • Sergey,
    Thank you for your work!!!
  • nqhXncMU,
    -1); waitfor delay '0:0:15' --
  • Romel,
    Yes beacouse it's true
Add new comment

If you have any questions, remarks, need help, or just like this page, please feel free to let me know by leaving a comment using the form bellow.
I will be happy to read every comment and, if necessary, I will do my best to respond as quickly as possible. Of course, spammers are welcome only as readers.