Image to Base64

Encode original image bytes as raw Base64 or a MIME-prefixed Data URL.

Images & Graphics
Preparing your workspace…

How to use

  1. Choose a supported PNG, JPEG or WebP file up to 2 MiB.
  2. Select Encode image and choose Data URL or Raw Base64.
  3. Copy the complete text or download it as a text file.

Image bytes as text

Base64 is useful when an API, document or small inline asset needs image data in a text field. It encodes the file bytes rather than converting the image into a new format.

A Data URL adds the MIME type and Base64 prefix. Raw Base64 omits that wrapper, so choose the output form expected by the receiving field.

Choosing the output form

A Data URL begins with data:, the detected MIME type and a Base64 marker. It can be used in contexts that accept inline image data.

Raw Base64 contains only the encoded payload. Do not add a Data URL prefix to an API field that expects just that payload.

Example
Input
PNG file bytes
Result
data:image/png;base64,iVBORw0KGgo…

Abbreviated Data URL showing the prefix and PNG payload; the ellipsis is not part of a usable encoded image.

Size and metadata

Base64 expands the byte representation by roughly one third before transfer compression. The Data URL prefix adds a little more text.

Encoding preserves the original file bytes, including metadata. It does not resize, recompress or sanitize the image; supported-image checks and the 2 MiB limit still apply.

Copying or downloading text

Copy exports the currently selected output form, and Download saves image-base64.txt. Changing between Raw Base64 and Data URL does not re-encode the underlying image.

Processing limits

Still PNG, JPEG and WebP: 20 MiB, 24 megapixels and 8,192 pixels per side. Base64: 2 MiB. SVG: 1 MiB. File inspection: 1 GiB with only the first 256 bytes read. Browser codec support varies. No files are uploaded.

?

Frequently asked questions

Is the image recompressed?

No. The original file bytes are encoded directly. Decoding the Base64 payload gives those bytes back.

Which format belongs in an HTML img src?

A Data URL includes the MIME prefix needed for inline image data. Raw Base64 alone is not a complete img src URL.

Why is the text larger than the image file?

Base64 represents each group of three bytes with four characters, plus padding where needed. It is an encoding, not image compression.

Does Base64 remove image metadata?

No. Metadata remains part of the encoded original file. Use a separate suitable workflow if you need to inspect or remove it.

Is the image uploaded?

No. The file is read and encoded in your browser. Copy and Download export text only when selected.

Find your next tool

Language

Switch language? Your current work will be cleared. Copy or download it first.