How to convert Image to Base64
- Select “Select Files” and choose your Image files.
- Under “Text output format”, choose Data URL for HTML/CSS or Plain Base64 when the destination requests only encoded text.
- Select “Convert all to Base64”. Review the text, then use “Copy” or “Download”.
Choose the text output format
Under Text output format, select the mode required by your destination. The preview, Copy, and Download actions all use that selection.
| Mode | Use | Contents |
|---|---|---|
| Data URL | HTML img / CSS background-image | MIME prefix + Base64 text |
| Plain Base64 | A field or API requesting encoded data only | No data: prefix |
A valid HTML and CSS example
The example below embeds a red 1 × 1 pixel PNG. Replace its data URL with the complete output for your image.
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==" alt="Red pixel" width="1" height="1">.sample {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==");
}iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==Encoded size and destination limits
The Base64 payload contains 4 × ceil(bytes / 3) characters, plus the prefix in Data URL mode. That typically adds about a third before any transport compression. Confirm that the destination accepts data URLs or Base64 and check its length limit.
Image files vs Base64 data URLs
| Aspect | Image | Base64 |
|---|---|---|
| Primary strength | Reusable file that can be cached and managed separately. | Self-contained text string for code and payloads. |
| Best use case | Use normal files for production images and reusable assets. | Use Base64 for small embedded assets, prototypes, and snippets. |
| Main trade-off | Image files require a path, host, or asset pipeline. | Base64 is portable but increases document or payload size. |
| Workflow fit | Keep the Image file when it remains useful as the source or archive. | Use Base64 when it better fits small icons, HTML snippets, CSS backgrounds, and JSON payloads. |
Things to know before converting
- Check the destination’s required format and length limit.
- Copy the complete output, not a shortened preview.
Frequently Asked Questions
What is an image Base64 data URL?
It is a text string that embeds the image data directly, usually starting with data:image/...;base64, so it can be pasted into code.
Should I convert every image to Base64?
No. Base64 is best for small, self-contained assets. Normal image files are usually better for large or repeated production images.
Does the image to Base64 converter upload files?
No. The encoding happens locally in your browser.