Base64 length
L = 4 × ⌈n ÷ 3⌉
Defined by RFC 4648; 12,000 bytes give 16,000 characters.
Encode an image to Base64 or decode a Base64/Data URI string into an image entirely in your browser.
Your files are processed locally in your browser and are never sent to our servers.
Drop your file here
Recommended size: up to 25 MB
Preview
Preview
Base64 turns the bytes of an image into text made of 64 safe characters. Encoded this way, an image can be pasted straight into CSS, HTML, a JSON file or an email as a data URI, with no separate file. This tool works both ways: it encodes an image to Base64 and rebuilds an image from a Base64 string or a data URI.
Image → Base64 tab: choose a PNG, JPEG, WebP, GIF or SVG image of up to 25 MB. It is read as is, without re-encoding, and converted into a complete data URI of the form data:image/png;base64,…, ready to copy. The preview confirms the image that was read, and a line shows the file size, the data URI size and the overhead in percent.
Base64 → Image tab: paste a data URI or a raw Base64 string. For a raw string, choose its MIME type (PNG, JPEG, WebP, GIF or SVG); spaces and line breaks are removed. The preview appears as soon as the string is valid, and Download image saves decoded-image with the extension that matches the type.
Base64 writes 3 bytes as 4 characters, so the text is about a third larger than the file, plus a few header characters. An invalid or truncated string shows "Invalid Base64 or Data URI."
Image → Base64 to encode, Base64 → Image to decode.
Drop an image, or paste a data URI or raw Base64 and set its MIME type.
Copy the data URI, or download the decoded image after checking the preview.
Base64 groups bytes by 3 (24 bits) and writes each group as 4 characters of 6 bits; the last group is padded with = signs.
L = 4 × ⌈n ÷ 3⌉
Defined by RFC 4648; 12,000 bytes give 16,000 characters.
L_URI = L + p
p is 22 for data:image/png;base64, and 26 for data:image/svg+xml;base64,.
Put an icon of a few kilobytes in background-image to save a network request.
Decode an image stored as Base64 in an API response or an export to view and save it.
Insert an image into a self-contained HTML file that must work without an images folder.
12,000 ÷ 3 = 4,000 groups of 3 bytes, i.e. 16,000 Base64 characters, plus 22 characters for data:image/png;base64,. The 34% overhead includes the header.
Input
icon.png, 12,000 bytesResult
16,022-character data URI; "11.7 KB file → 15.6 KB data URI (+34%)"The browser shows the icon without downloading a file. Keep this for small images: an encoded photo bloats the stylesheet and can no longer be cached on its own.
Input
Data URI of an SVG icon copied from the toolResult
.alert { background-image: url("data:image/svg+xml;base64,PHN2Zy…"); }No, quite the opposite: Base64 text is about 33% larger than the file. It is an encoding for carrying bytes inside text, not compression.
Base64 is the encoded text alone. A data URI adds a header such as data:image/png;base64, in front, which tells the browser the file type.
Paste it into the Base64 → Image tab and choose the MIME type of the original image (PNG, JPEG, WebP, GIF or SVG).
No. The file bytes are encoded as they are: decoding the data URI gives back exactly the same file, metadata included.
Yes, some tools wrap lines every 76 characters. The tool removes these spaces and breaks before decoding a raw string.
No. Encoding and decoding are done by the browser, with no network request.
Related tools
Tools similar or complementary to this one.
Lighten an image by setting its quality or aiming for a size in KB, with the final size shown before download.
Reduce SVG markup locally while keeping the graphic editable.
Convert an image to PNG, JPEG, or WebP and adjust output quality before download.
Understand EXIF, GPS, XMP, IPTC, ICC profiles, rights information, and how to manage image metadata for privacy, publishing, and Web performance.
Learn what changes when PDF pages are rasterized, how resolution and image format affect quality, and when to assemble images into a PDF.
Resize a batch of images, convert them to WebP and remove metadata with one reusable Pipeline.
Resize, compress and choose between WebP, AVIF and other formats with a practical workflow that reduces file size without unnecessary visual loss.