# Image to Base64: preserve file bytes in a data URL

> Read an image as a complete data URL without resizing, re-encoding or stripping the source metadata.

- Tool: [Image to Base64](https://toolsg.com/en/image-to-base64)
- Language: en (available: en, zh, ms, ta)
- Last verified against official sources: 2026-10-19
- Source site: ToolSG — a planning guide, not official or financial advice. Cite the agencies listed under Sources.

## Key figures at a glance

| Fact | Value | Source |
| --- | --- | --- |
| Encoded data | Original file bytes — The file is read with FileReader; it is not converted into a new PNG. |  |
| Output | Full image data URL — Includes the declared MIME type and the Base64 payload. |  |
| Payload length | 4 × ceil(n / 3) characters — n is the original file size in bytes; the data URL prefix is extra. |  |
| Canvas processing | None — The canvas converter's 16,777,216-pixel resizing cap is not applied here. |  |

## What this page does

Choose an image file that the browser identifies as an image and can decode. After the preview loads, FileReader reads the original file as a data URL. The result includes a prefix such as `data:image/png;base64,`, not just the characters after the comma.

This path does not draw into a canvas. File format, compressed data, embedded metadata and animation bytes remain in the encoded file. Displayed dimensions come from the browser's image decoder; the size beside them is the original file size, not the Base64 text length.

## Byte-count examples

These are reproducible 1 × 1 SVG files padded with comments to exact byte sizes. The actual page produced the following lengths, including the 26-character `data:image/svg+xml;base64,` prefix.

| Original bytes | Payload characters | Full URL characters |
| --- | --- | --- |
| 1024 | 1368 | 1394 |
| 2048 | 2732 | 2758 |
| 3072 | 4096 | 4122 |

## Encode and use the result

1. Choose or drop the image and wait for the preview and text output.
2. Copy the full result when the destination expects a data URL.
3. If an API expects raw Base64, supply only the payload after the first comma; do not include the prefix.
4. Check the receiving app's format and size requirements, and keep the original file.

## Limits and related tools

Base64 is encoding, not image compression or encryption. Large inputs increase text size and memory use. The tool imposes no canvas resizing step, but the browser still needs to decode and read the source and may have its own resource limits.

Processing is local rather than an upload for conversion. That does not remove metadata: sharing the encoded result can share any location or camera data already in the file. Copying the full data URL does not create a hosted public image address.

Use [the image resizer](https://toolsg.com/en/image-resizer) or [image converter](https://toolsg.com/en/image-converter) before encoding if you want a new, smaller image. Use [Base64 to image](https://toolsg.com/en/base64-to-image) for the reverse direction. The [text Base64 tool](https://toolsg.com/en/base64-encoder) displays decoded bytes as UTF-8 and is not a binary-image recovery workflow.

## Frequently asked questions

**Is my image uploaded anywhere?**

The file or supplied data URL is handled locally by your browser. These two pages do not upload the image for conversion.

**Will the quality drop?**

The original file payload is represented or downloaded without canvas re-encoding. Existing compression, metadata and animation bytes remain; this does not repair damage already present in the source.

**Why did my photo come out the right way up?**

The browser may use the file's orientation information for its preview. These Base64 paths do not rotate the stored pixels or remove the orientation tag; the original bytes remain.

**Is there a size limit?**

There is no 16,777,216-pixel canvas resizing step on these two pages. Browser decoding, memory and data URL limits still apply. Base64 text grows to 4 × ceil(n / 3) characters for n file bytes, plus the URL prefix.


## Sources

- [IETF — RFC 2397: data URLs](https://www.rfc-editor.org/rfc/rfc2397.html)
- [IETF — RFC 4648: Base64](https://www.rfc-editor.org/rfc/rfc4648.html)
- [W3C — File API: readAsDataURL](https://www.w3.org/TR/FileAPI/#readAsDataURL)
