ICO to Base64
Convert ICO 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 ICO to Base64 converter is identical to Image to Base64, with the only difference that it forces the mime type to be “image/x-icon” (even if the uploaded file has a different content type or it cannot be detected). Please note that the ICO 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 ICO.
About ICO
- Name: Windows icon
- Developer: Microsoft
- MIME types: image/x-icon, image/vnd.microsoft.icon
- File Extensions: .ico
- Uniform Type Identifier: com.microsoft.ico
- Type of Format: Raster graphics
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 ICO image formatted in each of the available formats (as an example image I use a one-pixel red dot ICO file):
• Plain text:AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==
• Data URI:data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==
• CSS Background Image:.base64 {
background-image: url("data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==")
}
• HTML Favicon:<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==" />
• HTML Hyperlink:<a href="data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA=="></a>
• HTML Image:<img alt="" src="data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==" />
• HTML Iframe:<iframe src="data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==">
The “iframe” tag is not supported by your browser.
</iframe>
• JavaScript Image:var img = new Image();
img.src = "data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==";
document.body.appendChild(img);
• JavaScript Popup:window.onclick = function () {
this.open("data:image/x-icon;base64,AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==");
};
• JSON:{
"image": {
"mime": "image/x-icon",
"data": "AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA=="
}
}
• XML:<?xml version="1.0" encoding="UTF-8"?>
<root>
<image mime="image/x-icon">AAABAAEAAQEAAAEAIAAwAAAAFgAAACgAAAABAAAAAgAAAAEAIAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAA==</image>
</root>
If I missed an important output format for Base64-encoded ICO images, please let me know — I would love to implement it.
Comments (5)
I hope you enjoy this discussion. In any case, I ask you to join it.
Thanks a lot,
François (Quebec, Canada)