Two-way image ⇄ Base64 conversion with one-tap copy — essential for inline images in front-end code
The screenshot below was taken in this tool with a real file and the stated settings — it is not a mock-up.
Base64 represents binary data using 64 printable characters (A–Z, a–z, 0–9, +, /). It splits every 3 bytes (24 bits) into four 6-bit groups, each mapping to one character.
Since 6 bits only express 0–63, matching exactly 64 characters, encoded data grows by about 33% (3 bytes become 4 characters). That is why Base64 images are larger than the original file.
On the web it is usually written as a Data URL: data:image/png;base64,xxxx. Browsers recognise this and load the text as an image resource, saving one HTTP request.
It works best for:
Turn small icons into Base64 inside CSS or HTML to cut request count
Recover Base64 images returned by an API to see how they look
Some mail clients require images to be embedded as Base64
Embed images inside JSON or YAML config
| Input | An image file, or a Base64 string (with or without the data: prefix) |
|---|---|
| Output | Data URL form (data:image/...;base64,) |
| Supported formats | PNG / JPG / WebP / GIF / BMP / SVG / AVIF / ICO / HEIC |
| Size change | About 1.33× the original file size after encoding |
| Privacy | Converted locally — never uploaded |
Base64 encoding inherently adds about 33%, an unavoidable overhead of the scheme. Avoid inlining large images — it is meant for small icons of a few KB.
Yes. The tool adds the data:image/png;base64, prefix automatically before parsing. If the original is a JPG but the prefix says PNG, most browsers still identify it correctly.
Yes. Paste a continuous string. If the Base64 contains line breaks, remove them first.
Image-to-Base64 is limited by browser memory, usually fine up to tens of MB. But an image over 1 MB becomes very large once encoded, so it is not recommended.