PNG to Base64

Turn a PNG file into a Base64 data URI in your browser.

Drag & drop a file here, or click to browse

Drop a PNG file here. Max 10 MB, converted in your browser.

PNG to Base64 Converter

Encode a PNG file as a Base64 string or a data:image/png;base64,... URI without uploading it anywhere. Drop a .png on the box above and you get a live preview, the original and encoded sizes, and output ready to paste into HTML, CSS, Markdown, or JSON.

About the PNG format

PNG (Portable Network Graphics) was created in 1996 as a patent-free replacement for GIF. It uses lossless DEFLATE compression combined with per-row filters, so text, UI elements, charts, and pixel art stay perfectly sharp. PNG supports 8-bit palettes, true color up to 48 bits, and a full 8-bit alpha channel for smooth, semi-transparent edges — something JPEG can't do. Every modern browser, email client, and operating system displays PNG, which makes it the safest choice for inline graphics.

What the output looks like

A PNG data URI always begins with data:image/png;base64,iVBORw0KGgo. The iVBORw0KGgo part is the Base64 form of the PNG signature. Choose Base64 only if an API expects just the raw string, or HTML tag to get a complete <img src="data:image/png;base64,..."> element.

When to inline a PNG

  • Small icons, logos, and UI sprites under roughly 4–8 KB.
  • Transparent overlays or badges in HTML email templates and signatures.
  • Single-file HTML reports, offline demos, and browser extensions.
  • Test fixtures and mock API responses that need a real image.

Large screenshots and photos should stay separate files: Base64 adds about 33% and the inlined bytes can't be cached separately. For photos, JPEG to Base64 or WebP to Base64 will produce much shorter strings. To check a string you already have, paste it into Base64 to Image.

Frequently Asked Questions

Yes. Base64 is a lossless text representation of the exact file bytes, so the alpha channel, color profile, and every pixel stay the same. When the data URI is decoded, the browser gets the identical PNG file.

Optimize the PNG before encoding it. Tools such as oxipng, pngquant, or TinyPNG remove metadata chunks (tEXt, iTXt, eXIf) and reduce the palette, which often cuts 30–70% of the size. Every byte saved in the file saves about 1.33 characters in the Base64 string.

Every PNG begins with the same 8-byte signature 89 50 4E 47 0D 0A 1A 0A, followed by the IHDR chunk. Encoded in Base64, these bytes always become iVBORw0KGgoAAAANSUhEUg, which is an easy way to recognize a PNG in logs or JSON.