Image to Base64
Encode any image as a base64 data URI.
Free image to base64 encoder. Upload an image and get its base64 data URI, copy it to the clipboard or download it as a text file.
Loading tool…
If the tool stays on this message, make sure JavaScript is enabled, then reload the page.
About Image to Base64
Sometimes an image shouldn't be a separate file at all. Embedding it directly in your HTML or CSS as a base64 data URI, a long text string starting with data:image/..., means zero extra HTTP requests, which is perfect for small icons, single-file demos, and HTML emails. This tool generates that string instantly from any upload.
The output appears immediately: copy it to your clipboard or download it as a .txt file for safekeeping. Files up to 25 MB are accepted, though you'll rarely want to encode anything near that size, because base64 inflates the data by about a third.
That inflation is the reason for restraint. Base64 is wonderful for a 4 KB icon and terrible for a 2 MB photograph: the page gets heavier, and unlike a separate file, an embedded image can't be cached independently by the browser. Rule of thumb: embed the small stuff, link the big stuff, and run candidates through the image compressor first.
How to use Image to Base64
- Upload your image.
- The base64 data URI appears instantly.
- Copy it or download it as a .txt file.
Why use this tool?
- One-click copy to clipboard
- Download as .txt
Tips for best results
- Embed small icons only: base64 shines under ~10 KB; larger images bloat pages and defeat caching.
- Compress first: run the image through the compressor before encoding to minimize the 33% size overhead.
- Use in CSS for tiny assets: data URIs in stylesheets eliminate requests for bullets, dividers, and icons.
- Keep alt text in HTML: an embedded image still needs its alt attribute, the data URI replaces the file, not the markup.
- Download the .txt: save long strings to a text file rather than keeping them on the clipboard.