What does converting an image to Base64 do?
Base64 is a way of writing binary data, such as an image file, using only ordinary text characters. The result here is a data URL, which starts with a prefix like data:image/png;base64, followed by the encoded content.
A data URL can be pasted straight into HTML or CSS as an image source, so the picture is carried inside the code rather than loaded from a separate file.
Base64 encoding makes data larger, because every 3 bytes of the image become 4 text characters. Expect the string to be roughly a third bigger than the original file.
When embedding an image as text makes sense
Embedding works well for small assets: a tiny icon in a stylesheet, a logo inside an HTML email template, or a placeholder image in a code sample. It removes one network request and keeps everything in a single file.
It is a poor choice for large photos, because the larger text string bloats your page and cannot be cached separately by the browser. If an image is big, compress it first with the image compressor before encoding.
When you need to check a string or turn it back into a picture, use the Base64 to image tool.
How to convert an image to Base64
- Drag an image onto the drop area, or click it to choose a file. Any image type your browser accepts is allowed.
- The tool reads the file locally and shows a small preview along with the full data URL in a text box.
- Click Copy Base64 to copy the whole string. The button changes to Copied for a moment.
Only the first file is used if you select several.
A short example of how it is used: paste the copied string into an img tag as src="data:image/png;base64,..." (with the full string in place of the dots) and the image renders without a separate file. Everything is processed in your browser, and the file is not uploaded.
Practical limits and tips
The output is the full data URL, including the data:image/...;base64, prefix. Some APIs and configuration files want only the raw Base64 part after the comma, so remove the prefix by hand if needed.
The text box is read-only and there is no download button, only copy. Very large images produce very long strings, which can be slow to paste or may exceed limits in the place you are using them.
Keep the original file as well. A Base64 string is awkward to edit, and converting an already compressed or resized image is better than encoding a heavy original.