Image to Base64
Free online image to base64. Convert image to Base64 data URI. No uploads needed.
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/image-to-base64" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free Image to Base64 tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/image-to-base64 --> <a href="https://www.theutilbox.org/tools/image-to-base64">Image to Base64 by The Util Box</a>
Frequently Asked Questions about Image to Base64
Image to Base64 — Encode a Picture as a Data URI
This image to Base64 converter turns an uploaded picture into the Base64 text you can paste
straight into HTML, CSS or JSON. Load a file and you get back either the complete
data:image/jpeg;base64,… URI or just the raw Base64 payload, depending on which
box you tick.
A preview of the image sits alongside the figures so you can confirm you loaded the right file, and the result can be copied to the clipboard or downloaded as a text file.
Why Encode an Image at All
Base64 is how binary data travels through channels that only handle text. Encoding a picture turns it into a
string that can live inside a JSON payload, a CSS url(), an email body or a
database column without needing a separate file and a path to it.
The trade-off is size. Base64 represents every three bytes of input as four ASCII characters, so the encoded string is about 33% larger than the original file — the tool prints that ratio next to the sizes so you can see the cost before you commit to it.
For anything beyond a small icon, a separate file with a real URL is smaller and faster. Base64 earns its place for inline icons, email signatures, and images that must travel inside a payload you cannot otherwise attach files to.
The Resize Option, and an Important Catch
Ticking Resize before encoding lets you cap the width and height in pixels. The image is redrawn onto a canvas at the new size, keeping the aspect ratio, and then encoded.
Here is the catch worth knowing before you use it: the resized output is always written as PNG, whatever format you uploaded. PNG is lossless, so a JPEG source becomes a much larger PNG — the "Base64 size" figure in that mode is the size of the new PNG, and it can easily be bigger than the original file despite the image now being smaller in pixels. There is no quality setting and no JPEG or WebP output option.
Without resizing, the original file bytes are used unchanged, so the data URI keeps whatever format the file was in.
Other Limits
- There is no file size limit in the tool, but a large photograph produces a data URI of many megabytes, which is impractical to paste into a stylesheet and slow in the browser.
- The file picker accepts any image the browser can decode, including SVG, WebP and AVIF where the browser supports them.
- Nothing is uploaded. The file is read with the browser's own FileReader API and encoded locally, so your image never leaves your machine.
- The download is a plain
.txtfile named after the original with.txtappended.
Related Image and Encoding Tools
- Base64 to Image — the reverse, turning a data URI back into a viewable picture.
- Base64 Encoder — encode text rather than binary.
- Base64 Decoder — decode a Base64 string back to text.
- Image Resizer — resize without the Base64 step, and with more format control.
- Image Compressor — shrink a file that is too heavy to embed.
- Image Cropper — cut an image down before you encode it.
- Image to PNG — convert format without encoding.
- Thumbnail Generator — produce a small preview image.
- Favicon Generator — a small icon worth embedding inline.
Everything happens locally in your browser — the image is never uploaded to a server.