Image to Base64 Converter

To include an image in a text document (HTML, CSS, JSON, XML), convert it to Base64 online. Use the resulting Base64 string as data URI, img src, CSS background-url, and more. This prevents binary characters from damaging the document's syntax. The encoder supports images up to 50 MB. For reverse conversion, check Base64 to Image.

Choose a file or drag and drop it here
The result of Base64 encoding will appear here

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 image formatted in each of the available formats (as an example image I use a one-pixel red dot GIF file):

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

Frequently Asked Questions

Img to Base64 conversion is a process of encoding an image file into a string of characters using the Base64 algorithm. This allows you to represent the image as a text string, making it easier to embed the image directly into HTML, CSS, or other text-based formats.

Yes, you can convert various image file formats, such as JPEG, PNG, GIF, or BMP, to Base64. The conversion process remains the same regardless of the image type.

Yes, Base64-encoded images can be decoded back to their original format using available methods or functions in programming languages and libraries.

Our Latest Blog

Dive into a treasure trove of insights and inspiration through our latest blog posts, designed to keep you informed, engaged, and up-to-date.

How Short URLs Revolutionize Link Sharing
In today's fast-paced digital age, where information travels at the speed of light, brevity is key. Enter the revolutionary concept of URL shorteners, which have transformed the way we share links online. These seemingly modest tools pack a punch by condensing long, unwieldy URLs into concise, manageable links that not only save characters but also enhance user experience.
Short URL vs. Long URL: Which is Better for SEO?
In the digital age, URLs play a significant role in shaping a website's search engine optimization (SEO) performance. URLs serve as the address for your webpages and can impact your site's visibility and ranking on search engine result pages (SERPs).
Mastering the Art of URL Shorteners
These compact tools not only make your links more presentable but also enhance the overall user experience. In this ultimate guide, we'll delve into the importance of URL shorteners and provide valuable insights on how