Image to Base64 Converter
Guide: Base64 Explained: What It Is and When to Use It
Drag an image here, or
Nothing you enter or choose here leaves your device. This tool runs in your browser.
What the tool gives you
Drop in an image and you get it back as text in four ready-to-use forms:
| Output | Looks like | Paste it into |
|---|---|---|
| Data URI | data:image/png;base64,iVBOR... | An image address in code |
| Base64 text | iVBOR... | A JSON field or API request |
| CSS | background-image: url(data:...) | A stylesheet |
| HTML tag | <img src="data:..."> | A web page or template |
A small icon, step by step
- Drop a 2 KB icon onto the box.
- Check the preview and file size. The text will be about a third bigger, so about 2.7 KB.
- Copy the CSS output and paste it into your stylesheet.
- Load the page. The icon appears with no separate download.
When it's a good idea
- Tiny icons and decorations under about 10 KB, where saving a request beats the extra size.
- A single-file HTML page, report or email template that has to travel as one piece.
- Sending an image inside a JSON request to an API that expects Base64.
- Quick prototypes and demos where you don't want separate files.
When it's not
- Large images. Base64 adds a third to the size, and the image can't be cached on its own, so it's fetched again with every page.
- Many images. The page code becomes huge and hard to edit.
- Email. Several mail clients block or strip data URIs in images. Link to a hosted image for newsletters.
- Photos. Compress them first with the image compressor, and link to them as normal files.
Going the other way
Open Base64 to Image, paste the text with or without the data URI header, and download the picture. It's a quick way to see what's inside a Base64 value you found in a config file or an API response. If the output doesn't open, the string may be cut off, may contain line breaks, or may not be an image at all.
Files up to 10 MB work, and nothing is uploaded. PNG, JPEG, GIF, WebP, SVG and ICO are all supported. To understand the encoding itself, read the Base64 guide, or encode text with the Base64 encoder.
Pasting it into code
In HTML, the data URI goes where a file address would go, in the src attribute of an image. In CSS it goes inside url(), with or without quotes. In JavaScript, put it in a string. If your editor slows down with a very long line, keep the data in its own file and import it, instead of leaving a huge line in the middle of your code. And if you later decide the image is too heavy, replacing the data URI with a normal link is a one-line change.
Written by Akinrinmade Michael · Updated October 24, 2026
How to use
- 1Drag an image into the box, or click to choose one.
- 2See a preview with the file size.
- 3Copy the data URI, the Base64 text, the CSS or the HTML tag.
- 4To go the other way, open Base64 to Image, paste Base64 and download the picture.
Frequently asked questions
When should I use a Base64 image?
For very small images, such as icons under about 10 KB, to save a network request. Large images become about a third bigger as Base64 and can't be cached on their own, so link to them instead.
Is my image uploaded?
No. The image is read in your browser and never leaves your device.
What is a data URI?
A way to put a file directly in a web address, such as data:image/png;base64,iVBOR... You can use it in an <img> src or in CSS.
Which formats work?
Any image your browser can read, including PNG, JPEG, GIF, WebP, SVG and ICO, up to 10 MB.
Read the guides
Learn how this works and how to get the most from it.
Developer
Base64 Explained: What It Is and When to Use It
How Base64 and Base32 encoding work, a worked example by hand, why Base64 makes data 33% larger, and when to use each. Neither one is encryption.
3 min read
Images
PNG vs JPG vs WebP: Which Image Format Should You Use?
A plain-English comparison of PNG, JPG and WebP: file size, transparency, quality, and which one fits photos, logos and screenshots.
3 min read
Related tools
SVG Optimizer
Make SVG files smaller by removing the extras editors add.
Image Converter
Convert between PNG, JPG and WebP in your browser.
Base64 & URL Encoder / Decoder
Encode and decode Base64 and URL-encoded text instantly.
Image Compressor
Make JPG, PNG and WebP images smaller. Private, in your browser.