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. Stays in your browser.

OUTPUT FORMAT

Runs entirely in your browser

How it works

The tool reads your image 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 yourselfin 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?
Encoding is byte-perfect. The resulting data URI carries the same alpha channel as the original PNG, so transparency renders correctly anywhere the URI is used.
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 size badge below the output shows exact numbers.
Can I decode this Base64 back into a PNG?
Yes. Pasting the full data URI into any browser address bar or HTML img tag renders the original PNG. The Base64 string can also be decoded with any standard library.

Related tools

Base64
Encode text or files to Base64, decode Base64, or convert images to data URIs.
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.