Image to Base64 Converter
Use this free image to Base64 converter to turn any picture into a Base64 data URI — a long piece of text that holds the whole image inside it, starting with data:image/png;base64, — so you can paste the image straight into HTML, CSS or an email instead of linking to a separate file. Developers use it for small icons and logos, email signatures, single-file web pages and API payloads. The page also works in reverse: paste a data URI or a Base64 string and get the image back, ready to download. Everything runs in your browser: your image is never uploaded or stored.
Image to Base64 Converter
Turn any image into a Base64 data URI for HTML, CSS & email.
Drop an image here, or
JPG / PNG / GIF / WebP / SVG — the image is converted on your device only.
Private by design: your image never leaves your browser — nothing is uploaded or stored. Base64 makes a file about 33% bigger, so it is best for small images like icons and logos; compress large photos first with the Image Compressor.
Decode Base64 back to an image
Paste a data URI (data:image/…;base64,…) or a plain Base64 string below, and get the image back.
How to use the Image to Base64 Converter
- Click “Choose image” or drag and drop a JPG, PNG, GIF, WebP or SVG file — or try the sample image.
- The image is read in your browser and the data URI appears instantly, with the file name, type, dimensions and sizes.
- Choose “Full data URI” or “Base64 only”, then copy the result — or copy it ready-made as an HTML img tag or a CSS background.
- To go the other way, paste a data URI or a Base64 string under “Decode” and download the image back.
What is Base64, and what is a data URI?
Base64 is a way of writing binary data — like a photo — as plain text, using only 64 safe characters: the letters A–Z and a–z, the digits 0–9, and + and /. A computer file is made of bytes, and bytes can hold any value from 0 to 255, including values that text systems cannot carry safely. Base64 solves that by repacking every 3 bytes into 4 text characters, so the result is pure text that can travel through email, JSON, HTML and code without being corrupted. A data URI takes that one step further: it is a small label in front of the Base64 text that says what kind of file it is — data:image/png;base64, for a PNG picture, or data:image/jpeg;base64, for a JPG photo — and a browser that sees a data URI does not need a separate file at all. It reads the text, decodes it, and shows the image, exactly as if it had downloaded a file.
How to convert an image to Base64
Choose an image or drag it onto the box above, and the converter reads it in your browser and shows the data URI instantly. You can copy the full data URI, which is ready to paste into an HTML img tag or a CSS background, or copy just the Base64 part without the data: prefix, which is what APIs and some apps expect. The result box also shows the file name, the image type, the width and height in pixels, and the size of the original file next to the size of the Base64 text, so you can see the cost of the conversion before you use it. The sample image button makes a small gold ToolKamai picture on the spot, so you can try every button without finding a file first. To go the other way, paste any data URI or Base64 string into the decode box and the picture appears, ready to download.
| Image file | Original size | Base64 text size | Best use |
|---|---|---|---|
| Small logo (PNG, 20 KB) | 20 KB | about 27 KB of text | Perfect — embed it directly |
| Profile photo (JPG, 100 KB) | 100 KB | about 137 KB of text | Fine for email signatures |
| Phone photo (JPG, 3 MB) | 3 MB | about 4 MB of text | Too big — compress first |
| Icon (SVG, 4 KB) | 4 KB | about 5.5 KB of text | Perfect — or use the SVG file itself |
Example
Try it with a real picture. Take a small logo of about 20 KB, drop it on the converter, and the output starts with data:image/png;base64,iVBORw0KGgo… — the iVBORw0KGgo beginning is the signature of every PNG file, so you can tell at a glance that the text really is a PNG. The stats say the original was 20 KB and the Base64 text is about 27 KB — the 33% overhead. Now click “Copy as HTML <img>” and you get <img src="data:image/png;base64,iVBORw0KGgo…" alt="logo.png">, which you can paste straight into a web page: the logo appears with no image file to upload. Copy it as a CSS background instead and you get background-image: url("data:image/png;base64,iVBORw0KGgo…"); for a stylesheet. Now try the reverse: paste that same data URI into the decode box and the logo appears again — proof that the text really holds the whole picture.
When to use Base64, and when not to
Base64 is the right choice when a file must travel as text. Email signatures are the classic example: most email programs cannot fetch an image from your website reliably, so a small logo embedded as a data URI always shows. Single-file web pages are another: a page saved as one .html file can carry its own images inside it, so it works offline and can be emailed as a single attachment. Small icons, buttons and logos under 50–100 KB are ideal — the extra size is tiny, and you save a separate file request, which can make a page load a fraction faster. It is the wrong choice for large photos: a 3 MB phone photo becomes 4 MB of text, which bloats the page, cannot be cached separately by the browser, and makes the HTML hard to edit. For those, keep a normal image file — and compress it first with the Image Compressor on this site. The same rule applies to email: one small embedded logo is fine, but a whole gallery of embedded photos will make the message huge and may be blocked.
Tips and common mistakes
- Keep embedded images small. Under 100 KB is ideal, and under 50 KB is better still. If the Base64 text is longer than a few lines on screen, the image is probably too big to embed.
- Do not use Base64 to hide a secret. Base64 is encoding, not encryption — anyone can decode it in seconds. Never put a password, a private photo or a secret document into a data URI and share it.
- Check the format: JPG or PNG? Photos should be JPG, which is much smaller; logos and screenshots with sharp edges should be PNG. Converting a 3 MB PNG photo to Base64 only makes a bad choice worse — save it as JPG first.
- Use the right output for the job. HTML and CSS need the full data URI, including the data:image/png;base64, prefix. APIs and databases usually want the Base64 part only — use the “Base64 only” option for those.
- Watch the = padding. A valid Base64 string ends with zero, one or two = signs and its length is a multiple of 4. If decoding fails, the string is usually cut off or has a space or line break in the middle — copy it again in full.
Frequently asked questions
What is a Base64 data URI?
A data URI is a way to embed a whole file inside a piece of text. It starts with the file type, for example data:image/png;base64,, followed by the image encoded as Base64 letters and numbers. A browser reads that text and shows the image — no separate image file or link is needed.
Is my image uploaded anywhere?
No. The image is read in your browser with the FileReader tool and never leaves your device — safe even for private photos and client work.
How much bigger does Base64 make my image?
About 33% bigger: every 3 bytes of image become 4 characters of text. A 100 KB photo becomes roughly 137 KB of text, so Base64 is best for small images like icons and logos — large photos are better kept as normal files.
Is this image to Base64 converter really free?
Yes, 100% free, no sign-up, no limits. It runs entirely in your browser — convert as many images as you like.
Which image formats work?
JPG, PNG, GIF, WebP, SVG, BMP and ICO — anything your browser can read as an image. Photos work best as JPG, logos and screenshots as PNG, and simple graphics as SVG.
Why would I use Base64 instead of a normal image link?
When the image must travel as text: email signatures, single-file HTML pages, small icons in CSS, and data sent to an API. For large photos a normal image file is better, because Base64 is about a third bigger and cannot be cached separately.
Image Compressor
Reduce JPG/PNG photo size without uploading — great for forms & WhatsApp.
QR Code Generator & Scanner
Create a QR code from any link or text — and scan QR codes too.
JSON Formatter & Validator
Format, beautify, minify & validate JSON with exact error lines.
Base64 Encoder & Decoder
Encode text to Base64 & decode Base64 back to text, free.