inyourbrowser.com

PNG to Base64

Drop a PNG file and get an instant Base64 string. The default output is a complete data URI you can drop into an HTML img tag, a CSS background, or a JSON field. All encoding runs in your browser.

Drop an image or click to choose

JPEG, PNG, WebP, GIF, SVG, AVIF, up to 50 MB. Runs in your browser.

OUTPUT FORMAT

METADATA

Runs entirely in your browser

How it works

By default the tool first removes the camera and editing metadata (EXIF including GPS, XMP, IPTC, comments, and C2PA) from a copy of your image, keeping the pixels and orientation; tick Keep original metadata to encode the file unchanged. It then reads the result with the FileReader API as a data URL. FileReader returns a string of the form data:image/png;base64,XXXX, where everything after the comma is the Base64-encoded file. The tool can show the full URI, strip the prefix to return raw Base64, or wrap it in a CSS background snippet, all in your browser tab.

Processing runs in your browser

All Base64 encoding happens locally in your browser tab using FileReader. Our servers are not involved at any point. You can verify this yourself in your browser's DevTools Network tab.

Frequently asked questions

Is my PNG uploaded to a server?
All PNG to Base64 encoding runs in your browser using FileReader. Our servers are not involved at any point.
Does encoding preserve the PNG transparency?
Yes. Only metadata chunks are removed by default (text, EXIF, and similar); the pixel data, including the alpha channel, is copied unchanged, so transparency renders correctly anywhere the URI is used. Tick Keep original metadata for a byte-for-byte copy of the file.
When should I inline a PNG as Base64?
Inlining works well for small icons, email signatures, or single-file HTML reports. For larger PNGs prefer a regular asset URL to keep the document size small.
How big will my Base64 PNG be?
Roughly 33 percent larger than the original file because Base64 uses 4 ASCII characters per 3 binary bytes. The File and Out badges show the exact numbers.
Can I decode this Base64 back into a PNG?
Yes. Pasting the full data URI into an HTML img tag renders the same image as the original PNG. The Base64 string can also be decoded with any standard library. The decoded file matches the original byte for byte only if you ticked Keep original metadata; by default its metadata chunks are gone.

Last reviewed September 30, 2026

Other pages for this tool

Related tools

Convert image
Convert between JPEG, PNG, and WebP formats. Lossless or quality-controlled.
Compress image
Reduce JPEG, PNG and WebP size with a quality slider. Compression runs in your browser.
Favicon generator
Generate favicon PNGs in 16, 32, 48, 64, 192, and 512 pixel sizes from any image. Runs in your browser.
Base64
Encode text or files to Base64, decode Base64, or convert images to data URIs.