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

PNG to Base64

Convert PNG 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 PNG to Base64 converter is identical to Image to Base64, with the only difference that it forces the mime type to be “image/png” (even if the uploaded file has a different content type or it cannot be detected). Please note that the PNG 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 PNG.

How to convert PNG to Base64 online

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

About PNG

  • Name: Portable Network Graphics
  • Developer: PNG Development Group
  • MIME types: image/png
  • File Extensions: .png
  • Uniform Type Identifier: public.png
  • 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 PNG image formatted in each of the available formats (as an example image I use a one-pixel red dot PNG file):

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

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

Comments (2)

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

  • AngryTooOfDoom,
    this is exllent
  • Santiago,
    I want to send emails from excel with a macro using an outlook account. I want to put one Base64 image on my email but...It's impossible. Instead of the image into the email there is a square with a red x inside. I start writing the macro lilke this:

    MensajeHTML = MensajeHTML & "<img src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARsAAABUCAIAAAA9NgR7AAAACXBIWXMAAAsTAAALEwEAmp"
    MensajeHTML = MensajeHTML & "1v73unsyedPRBCAgFkky2yQ1gUFRF0ZtxlHD9RZxyHcb7xm1FBHQSEAQSCIiqKIvu+hiSkk973/e5LLWf7/qjuTshGQro7xOf+ni"
    ...... this continues with all the data collected from the Base64 field on this page till the last line wich is:
    MensajeHTML = MensajeHTML & "ToFRBXwoSDW+uh2CY70haYFRBRQwlSi0+S6ggAKjCiigwKgCCigwqoACCigwqoACjh7+/wCoanLFlsvTqgAAAABJRU5ErkJggg== />"

    It's impossible to see the image on my email!

    Can you help me please??
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.