Free Image to Base64
Convert images to Base64 strings for embedding in HTML, CSS or JSON. No upload, instant, private. Free, with no sign-up required — your file is processed right in your browser and never uploaded to a server.
🖼️ Image to Base64
How the Image to Base64 Works
Upload an image and the tool reads it with the browser's FileReader and encodes the bytes as Base64 text. Choose Data URL, which includes the data:image/...;base64, prefix and can be pasted straight into an img tag or a CSS url(), or Raw Base64 for only the encoded characters. You can copy the text or download it as a .txt file.
Base64 represents binary data using 64 printable characters, which makes it safe to place inside text formats such as HTML, CSS, JSON or email. The price is size: the text is about 33% larger than the image file. Embedding is a good idea for tiny icons that would otherwise need a separate request, and a poor idea for large photos.
Practical Use Cases
- Embed a small icon directly in CSS or HTML so it loads without another request.
- Include an image in a JSON payload or API request.
- Add an inline image to an HTML email template.
- Store a small image in a configuration file or database field as text.
Tips for Best Results
- Embed only small images, such as icons under about 10 KB. Larger images are better as separate files that the browser can cache.
- Use the Data URL option for HTML and CSS, and the Raw option for APIs that add their own prefix.
- Compress the image first with the Image Converter or Image Resizer. A smaller source gives a much shorter Base64 string.