Use this free image to Base64 online tool: pick or drop a file, preview images, see size stats, and copy a full data URL or raw Base64. Runs locally in your browser.
Image to Base64 online means reading a file’s raw bytes in the browser and representing those bytes with the Base64 alphabet so they can sit inside text-heavy places—HTML attributes, JSON fields, CSS, or chat messages. The output is longer than the source file: Base64 expands binary by design. Nothing here encrypts your file; it is the same data in a different envelope.
This page uses the FileReader API. Files stay on your device; we do not upload them for conversion. Pick from the file chooser or drag into the drop zone. Images get an on-page preview; other binaries (for example PDFs) still become a valid data URL and raw payload when preview does not apply.
data:mime;base64,…) or the raw Base64 body, depending on what your API or template expects.The encoder groups bits according to the Base64 scheme: roughly four text characters for every three bytes, with padding to a multiple of four. The character count in the output is predictable from the file size. See our Base64 images and data URLs article for design trade-offs when inlining media.
After converting a small PNG, you may copy a string such as data:image/png;base64,iVBORw0KGgo… into a prototype img tag’s src. For production, balance HTML weight against eliminating an extra HTTP request—often a CDN and responsive srcset win for large photos.
If an API wants only the payload, strip the header and use the substring after base64,. If the service rejects the value, confirm whether it expected URL-safe Base64, hex, or a multipart binary upload. Pair with the text encoder for configuration strings that sit next to file blobs.
Images in markup: inline tiny icons or test fixtures. APIs: mobile or script clients sometimes post Base64 JSON fields when multipart uploads are awkward. Documentation: copy portable snippets for tickets and runbooks. When you are comparing text and binary layers, the Base64 vs UTF-8 post clarifies the stack.
The browser reads the file as an ArrayBuffer, which is the exact byte content on disk. Those bytes are Base64-encoded and optionally prefixed with a data: URL that names the MIME type so consumers know how to interpret the payload.
A data URL has the form data:[<mediatype>][;base64],<data>. The ;base64 flag tells parsers the following comma-separated segment is Base64, not percent-encoded ASCII.
Inline data URLs can remove an extra HTTP request for a tiny icon, but they increase HTML/CSS weight, hurt cache granularity, and can damage LCP on large files. For photos and above-the-fold art, use responsive img with CDN URLs, modern formats, and long cache lifetimes. See the Base64 images guide for trade-offs.
As a rule of thumb, keep inlines under a few kilobytes for critical icons; above tens of kilobytes, measure LCP and total transfer size. Multi-megabyte Base64 in HTML is almost always a mistake—use object storage and normal URLs.
In service workers and Node, you can Base64 a buffer with the same table as on this page. For browser-only quick tests, this UI avoids shipping keys or uploads.
Pick or drop a file. Images get a live preview; PDFs and other binaries still encode to Base64 locally — nothing is uploaded. You get a data URL and the raw Base64 body.
Drag and drop a file here, or choose one below.
Base64 (payload only, no data: header)
Base64 will appear after you select a file.