About this image to base64
This image to base64 encoder represents the original bytes of a selected raster image as portable text. It is useful when a development workflow expects a data URL, when embedding a small icon in a document, or when testing an interface that accepts encoded image data. It does not redraw, resize, or compress the picture.
Select one or several files and press Encode base64. Each image produces two selectable read-only fields: a complete data URL containing its MIME type, and plain base64 without that prefix. A text download lets you save the complete data URL without relying on clipboard permissions. The page also reports the original byte count and the length of the encoded text.
The MIME type is inferred from the file signature instead of trusting the filename. Encoding preserves metadata and all original file bytes, including animation data already present in the source. Base64 usually increases storage by about one third before the data URL prefix, so it is not an optimization for large photographs. Keep each file below 40 MiB, and remember that embedding a camera photo can also embed its private EXIF information. No file is uploaded or stored by this tool.
Which controls should I check first?
The Image to Base64 form labels its controls as Choose image files (up to 20, 40 MiB each). Use those labels to keep the source and settings separate. A sample argument that selects a mode is not additional source text. Choose the setting matching your intended operation before copying a result, and change it explicitly when comparing another mode. The labels describe what this form accepts; the worked examples below demonstrate only the stated supplied values.
How should I interpret this specific operation?
Encoding three bytes yields four Base64 characters before a data URL prefix. The original image bytes, including any embedded metadata and animation already in the file, remain in the representation. Base64 therefore differs from the pixel conversion workflow, which writes a new raster file. Choose plain Base64 or a complete data URL according to the receiving field, and consider size before embedding a large photograph.
Worked helper values
These values come from the reproducible calculation examples supplied with this tool. Each row identifies the complete supplied arguments and the returned value. A visible ↵ denotes a line break and ⇥ denotes a tab in text examples. Settings appear alongside source data so that a different mode is not mistaken for an identical input. These are helper calculations, not observations of a live device, fetched target, image decoder, browser preview or downloaded file. Use the stated method above to relate the returned fields to the actual operation.
| Supplied values | Calculated return value |
|---|---|
| photo.heic; jpg | photo.jpg |
Is this a representation change or a content change?
An encoding expresses bytes or characters using a different alphabet or escape notation. It should not be confused with encryption, compression or permission to execute the result. Work out which layer the receiving field expects before converting. A URL component, a complete URL, an HTML text node and a JSON string need different escaping rules. Encoding for one context does not automatically make a value safe in another. Keep the unencoded source while editing and convert at the boundary where the destination requires it. Otherwise repeated conversions can encode existing escape markers rather than the original content.
How do I diagnose a malformed input?
Check the alphabet, prefix, separators and final padding against this tool's documented input format. A pasted quotation mark or trailing label can turn a valid payload into invalid text. For UTF-8 decoding, a byte sequence can be syntactically valid in its outer representation yet still fail to represent text. Binary images and compressed data are examples of payloads that should not be forced through a text decoder. Use the appropriate file or image workflow for them. Do not remove padding or percent signs at random to make an error disappear; first identify what those characters mean in the expected representation.
Why does decoding once matter?
A value can have more than one encoding layer. Decoding the outer layer yields another encoded string rather than necessarily reaching the final readable content. Repeating the operation is appropriate only when the source format specifies those layers. With URL components, decoding separator characters too early can change the structure of a query. With HTML entities, a decoded angle bracket is ordinary text until another application interprets it as markup. Inspect the result as text before placing it into an active context. Keep a record of which layer you decoded so that a later step does not accidentally repeat it.
How do non-ASCII characters affect the result?
A character such as é occupies more than one UTF-8 byte. An emoji can require several bytes even when it occupies one visible position. Encoders process those bytes according to their representation rules, so output length cannot be predicted from visible character count alone. A percent-encoded character can consist of several percent triplets, and Base64 groups bytes rather than visible letters. Compare the worked Unicode example with the result instead of assuming one output group per character. A strict text decoder helps expose damaged bytes that would otherwise be replaced by an ambiguous replacement character.
Is a data URL different from plain base64?
A data URL adds data:, a MIME type, and ;base64, before the encoded bytes.
Does encoding remove metadata?
No. All original bytes remain, including camera tags, GPS data, and animation frames.
Why is the encoded text longer?
Base64 stores three binary bytes in four text characters, with padding when needed.
Does HEIC base64 work in every browser?
Encoding works, but displaying that data URL still requires a HEIC decoder in the receiving application.