Input

Click to upload image

JPG, PNG, GIF, WebP, SVG (Max 5MB)

Output

Image to Base64 Examples

Upload an image to get a Data URI. The output format is data:image/<type>;base64,<base64-string>.

Sample Data URI output

Output format

Upload an image above to generate your own Data URI.

What Is Image to Base64?

Image to Base64 converts image files into Base64-encoded Data URIs. Base64 is defined by RFC 4648.

This tool uses the browser's FileReader API. For decoding Base64 back to a viewable image, use Base64 to Image.

How to Use This Tool

1

Upload Image

Click the upload area or use Upload. Supported formats: JPG, PNG, GIF, WebP, SVG (max 5 MB).

2

Get the Base64 Output

The right panel updates automatically with the full Data URI.

3

Copy or Download

Use Copy or Download. For encoding any file, use Base64 Encoder. For viewing Base64 image strings, use Base64 to Image.

How It Works

The tool reads your image using FileReader.readAsDataURL(). Base64 encoding increases size by ~33%.

For HTML: <img src="data:image/png;base64,...">. For CSS: background-image: url(...).

Where Image to Base64 Helps

Web developers use Base64 for small icons. Email HTML often embeds images as Base64.

For decoding use Base64 to Image. For encoding any file use Base64 Encoder. For general Base64 decoding use Base64 Decoder.

Frequently Asked Questions

Is my data private?

Yes. Conversion runs entirely in your browser.

What's the size limit?

The tool limits uploads to 5 MB.

Can I use the output in HTML/CSS?

Yes. The output is a Data URI ready for img or background-image.

Does it support SVG?

Yes. SVG is supported. Use Base64 Decoder to decode back to SVG.

Why use Base64 instead of a regular image URL?

Base64 embeds the image in the document, so no extra HTTP request is needed.

Related Tools

Ver RFC 4648.