Loading Image to Base64 Converter...
How to Convert PNG to Base64 - Step by Step Guide
Upload Your PNG Image
Start with your PNG image. Click the "Upload" button or drag the file onto the left panel. Icons, logos, screenshots and UI sprites with see-through backgrounds are the usual candidates.
Check the Preview and the Output
As soon as the file is read, the Base64 encoded string appears on the right. On the left you see the image, its file size and the format detected from the file's first bytes.
data:image/png;base64, in frontUnderstanding Base64 Encoding
What happens to your PNG:
iVBORw0KGgo once encodedCopy or Download Your Base64 String
"Copy" puts the string on your clipboard and "Download" saves it as a text file. Both hold exactly what you see in the editor.
<img src="data:image/png;base64,..."> tagsWhat is PNG to Base64 Conversion?
PNG to Base64 conversion writes the bytes of a Portable Network Graphics file out as plain text, using 64 characters (A-Z, a-z, 0-9, + and /). That text can sit inside HTML, CSS, a JSON payload or an email template where a binary file could not.
PNG compresses without losing detail and can store an alpha channel, which is why it is the usual choice for logos and icons with transparent edges. Because the page encodes the file as it is, none of that changes: decoding the string gives you the same PNG back.
How PNG to Base64 Encoding Works
The browser reads the PNG as a data URL, which is the MIME type (image/png) followed by the Base64-encoded bytes. The page keeps only the part after the comma, so you get the bare string and add the prefix where you need it.
Inline PNGs work best for small things: a favicon in a single-file HTML page, icons inside a stylesheet, a logo in an email signature, or an image field in a JSON API. Big images are better left as separate files, since a long string makes the HTML or CSS heavier and cannot be cached on its own.
Frequently Asked Questions
How do I turn a PNG into Base64?
Click Upload and pick the .png file, or drop it onto the left panel. Once the browser has read it, the Base64 string fills the editor on the right, and Copy or Download gives you exactly that text. To turn a string back into a file later, paste it into Base64 to PNG.
What does a PNG look like once it is encoded?
Every PNG file opens with the same eight bytes (89 50 4E 47 0D 0A 1A 0A), so every PNG string starts with iVBORw0KGgo. Almost all of them go on with iVBORw0KGgoAAAANSUhEUg, because the IHDR header comes right after the signature. If a string you were handed starts with /9j/ it is a JPEG, and R0lGOD means a GIF, whatever the file name said.
Is the transparent background kept?
Yes. The page encodes the file byte for byte and never redraws the image, so the alpha channel, the palette, 16-bit colour depth and any text chunks inside the PNG all end up in the string unchanged. Decode it and you get the identical file back, transparent corners included.
How do I use the string in HTML, CSS or an email?
Put data:image/png;base64, in front of it. In HTML that is <img src="data:image/png;base64,YOUR_STRING" alt="...">, and in CSS background-image: url(data:image/png;base64,YOUR_STRING);. The output panel holds only the Base64 part, so add the prefix yourself. HTML emails take the same data URI, but some mail clients (Gmail, for one) do not show inline data images, so send yourself a test first.
What if my file is not really a PNG?
The format is read from the first bytes of the file, not from its name. A JPEG or GIF saved as .png is still encoded exactly, but it is labelled with its real format and a note tells you which data URI prefix to use instead of data:image/png. A text file or anything else that is not an image is refused with a message.
Why is the Base64 bigger than the PNG?
Base64 writes every 3 bytes as 4 characters, so the text is about a third larger than the file: a 30 KB icon becomes roughly 40 KB of text. That is fine for logos, icons and small UI graphics. For large screenshots or photos a normal image file is better, because the browser can cache it separately. The page accepts files up to 10 MB.
Is my image uploaded anywhere?
No. Your browser reads the PNG and builds the Base64 string on your own device, so the image is not sent to a server and nothing is kept. A reload gives you an empty panel again.
Need the image back? Base64 to PNG turns a string into a .png file again, and Base64 to Image works out the format for you. For JPEG, WebP, GIF or SVG files, use Image to Base64.
Related Tools
Image to Base64
Convert images to Base64 encoded strings for embedding in HTML, CSS, and APIs
Base64 to Image
Decode Base64 encoded strings to view and download images (PNG, JPG, GIF, SVG)
Base64 to PNG
Decode Base64 strings to PNG images, see the picture and save the exact file
BMP to Base64
Convert BMP/Bitmap images to Base64 encoded strings
Base64 to BMP
Decode Base64 strings to BMP/Bitmap images
Base64 to WebP
Decode Base64 strings to WebP images with transparency