Image ↔ Base64 converter

Copy PNG, JPG, GIF, WebP or SVG as Base64, or paste an encoded image to recover the original file.

Formats PNG · JPG · GIF · WebP · SVGSteps & examples
A landscape photograph unrolls into punched paper tape.

Workspace

Runs locally in your browser. No file upload.

Preset parameters

Input & settings

Choose a file to get startedRead locally · No upload · 20 MiB max

No file selected

Select a file or paste data to begin.

Result

Run the tool to check your output here.

Encode or recover an image

  1. Choose an image file, or paste Base64 to decode it.
  2. Select Image to data URL if you need a value for an HTML image source.
  3. 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.