Encode or recover an image
- Choose an image file, or paste Base64 to decode it.
- Select Image to data URL if you need a value for an HTML image source.
- Convert, then copy the text or download the result.
Worked example
For an inline PNG in HTML, choose Image to data URL and copy the entire result into the src attribute.
Input and output
Choose raw Base64 for a field whose specification already identifies the image type. Choose a data URL when the receiving field expects an entire image source including its media type. In the reverse direction, the downloaded file contains the decoded bytes, including any metadata present in those bytes.
Format and size limits
The original or decoded image must fit within 20 MiB, and bitmaps are limited to 24 megapixels. Base64 uses four characters for each group of three bytes. Allow room for that expansion if a form limits the length of the text you paste.
If processing fails
If a pasted value is rejected, copy the encoded value itself from its source, leaving out surrounding HTML, quotation marks and any truncation dots. A regular web address pointing to an image contains no image bytes to decode.
Questions about this tool
What is the difference between Base64 and a data URL?
Raw Base64 contains the encoded bytes. A data URL also specifies the file type, for example data:image/png;base64, before those bytes.
Will decoding change the image quality?
Decoding restores the original file bytes, including transparency, animation and embedded metadata.
How it works
Base64 represents the original file bytes as text. A data URL adds the image type so the result can be embedded in HTML or CSS.
Important limitations
Images up to 20 MiB and bitmaps up to 24 megapixels. Base64 text is roughly one third larger than the image.
