Image Tools

Image to Base64 Converter: Data URL, HTML and CSS

Convert an image to Base64 text in your browser and copy it with one click. Choose a data URL, plain Base64, a ready-made HTML img tag or a CSS background rule. The image is read on your device and never uploaded.

01

Your inputs

Choose your file, then set the options.

Maximum 5 MB per image.

Processed in your browser. Your inputs stay on this device.

02

Your result

A little clarity, coming right up.

Make room for the answer.

Enter your values and run the tool. Your result will appear here.

How to use the Image to Base64 Converter

Choose your file and the result is ready in a moment. It is processed in your browser, so nothing is uploaded.

Read more: How to Use the Image to Base64 Converter: Step by Step Guide

How it works

The file's bytes are encoded as Base64 (every 3 bytes become 4 characters) and, for a data URL, prefixed with data:, the image type and ;base64,

Examples

  • Worked example
    Embed a small logo or icon directly in an HTML email, a CSS file or a JSON payload without hosting the image.

Limitations and assumptions

Images up to 5 MB. Base64 text is about a third larger than the image, so it suits small images such as icons and logos; large images are better linked as files.

Frequently asked questions

What is a Base64 data URL?

A data URL puts a whole file inside a piece of text, such as data:image/png;base64,iVBOR… Browsers can show it like a normal image link, so the image needs no separate file.

Why is the Base64 text bigger than the image?

Base64 turns every 3 bytes into 4 characters, so the text is about a third larger than the file. That is why it suits small icons and logos rather than photos.

Can I turn Base64 back into an image?

Yes. Paste the data URL into a browser address bar to view it, or decode the Base64 with the Base64 encoder and decoder for text.