What is an image to Base64 converter?
An image to Base64 converter turns a picture file into a long string of plain text. That text is the picture — every byte of it, rewritten in the 64 safe characters of the Base64 alphabet (A–Z, a–z, 0–9, plus and slash, with equals as padding) — so it can travel anywhere text can go and a binary file cannot: inside an HTML page, inside a stylesheet, inside a JSON message, inside an email.
The most common form of the output is a data URI: the Base64 string with a small header in front, like data:image/png;base64,iVBORw0KGgo…. The header tells the browser what kind of file the text describes, and the browser treats the whole string exactly like a normal image URL — except the picture is baked into the text, so no separate file is requested. Paste a data URI into an <img src> and the image appears. Paste it into a CSS url() and it becomes a background. No file to host, no request to make, no link that can break.
This tool does the conversion on your own computer, inside your browser, using the browser's built-in FileReader. The image is read, encoded, and shown to you — it is never sent to a server, which is why there is no upload progress bar and no copy of your picture sitting on somebody else's computer afterwards. That also means it works offline once the page has loaded, and it works the same on Windows, macOS, Linux, Android and iPhone.
How to convert an image to Base64
- Add images. Drag one or more JPG, PNG, WebP, GIF, SVG, AVIF, BMP, ICO or HEIC files onto the box above, click the box and pick files from your computer, or copy an image and paste it with Ctrl+V (Cmd+V on a Mac). Up to 30 files at once, up to 50 MB each.
- Pick an output format. The picker starts on Data URI, the ready-to-paste form. Switch to raw Base64 if the other side expects just the encoded data, or to CSS, HTML or Markdown for a ready-made snippet. Changing the format updates every card at once — nothing is re-encoded.
- Check the size. Each card shows the original size next to the data-URI size, with the overhead as a percentage, and a note on whether the result is small enough to inline. A 12 KB logo becomes about 16 KB of text; a 1 MB photo about 1.37 MB — you see the cost before you paste.
- Copy or download. Copy the data URI, CSS rule, HTML tag or Markdown image for one picture, copy everything at once, or download all results as one
base64-images.txtfile, labelled by filename. A file that is not an image only fails its own card — the rest still encode.
Very long outputs are shortened in the box on screen — a 5 MB image makes a string of several million characters. Copy and Download always give you the complete string; only the preview is trimmed, and it says so.
Converting several images at once
You do not have to convert icons one by one. Select several files at once in the file picker, or drag a whole group of them onto the box, and each one gets its own card: a preview thumbnail, the file type and dimensions, the original size against the data-URI size, and its own copy buttons. The batch summary at the top adds the totals up, so you can see what a whole icon set costs as inline text.
“Copy all” copies every image in the format currently picked, separated by blank lines. “Download all as .txt” saves the same set to one file, with each image labelled by its filename so you can find it again later. Changing the format and copying again gives you the same batch as CSS rules or Markdown images — handy when you are building a stylesheet from a folder of icons and then need the same set for a README.
Keep batches modest on older phones and computers: each image is held in memory while it is processed, so thirty 50 MB photos is a lot to ask of a small device. Split very large jobs into a few smaller batches, and compress big photos first — the Image Compressor on this site does that in the same way, locally.
Data URI vs raw Base64 — when to use each
The two outputs differ by one short header. Raw Base64 is only the encoded data: iVBORw0KGgoAAAANSUhEUg…. A data URI is that same string with data:image/png;base64, in front, which names the file type so the browser knows how to read it. Which one you need depends entirely on what consumes the string.
| Output | Looks like | Use it in |
|---|---|---|
| Data URI | data:image/png;base64,iVBOR… | An <img src>, a CSS url(), an email, anywhere a URL is expected |
| Raw Base64 | iVBORw0KGgoAAAANSUhEUg… | A JSON field, a database column, an API that takes the file content and the type separately |
| CSS background-image | background-image: url("data:…"); | A stylesheet, ready to paste |
HTML <img> | <img src="data:…" alt="logo" width="…" height="…"> | An HTML page, with alt text and dimensions filled in |
| Markdown image |  | A README or a document that renders Markdown |
The most common mistake is pasting the full data URI where raw Base64 was expected, or the other way round. If an API rejects your string, check which of the two it wants first: a data URI in a field that expects raw Base64 will fail to decode, and raw Base64 in an <img src> will show a broken image, because the browser has no way to know what kind of file the text describes. The format picker on this page exists so you never have to strip the header by hand.
How much bigger does Base64 make things?
Base64 writes every 3 bytes as 4 characters, so the encoded text is about a third larger than the file — and the overhead is constant, whatever the size. The data-URI header adds a fixed 22 characters on top (data:image/png;base64,), which barely matters on a large file but dominates a tiny one: a 70-byte 1×1 PNG becomes a 96-character Base64 string and a 118-character data URI.
| Original size | Base64 size | Overhead |
|---|---|---|
| 3 bytes | 4 characters | +33% |
| 3 KB | ~4 KB | +33% |
| 12 KB | ~16 KB | +33% |
| 100 KB | ~133 KB | +33% |
| 1 MB | ~1.37 MB | +33% |
That constant overhead is the whole trade-off of this tool. It is why Base64 is perfect for tokens and small images and a bad idea for large files — and why each card tells you the size before you paste. As a rule of thumb: up to about 8 KB of text is great for inlining, up to about 100 KB is fine for an icon or a logo, and above that you are usually better off linking the file and letting the browser cache it separately.
Three everyday uses
1. Inlining small icons and logos in HTML or CSS
A tiny icon as a separate file means an extra request every time the page loads. Embed it as a data URI — background-image: url(data:image/png;base64,…) — and the image travels inside the stylesheet itself. That is the right call for icons under a few kilobytes; for large photos it is not, because Base64 makes the file a third bigger and the browser cannot cache it separately from the page. Copy the CSS snippet from the card and paste it straight into your stylesheet — the rule is complete, quotes and semicolon included.
2. Embedding images in HTML emails
Many email clients block externally referenced images by default, so a logo hosted on your server shows up as an empty box until the reader clicks “load images”. Embedding the logo as a Base64 data URI puts the picture inside the email itself, so it renders immediately. Keep the image small — a logo under 50 KB is ideal — and test in the clients your readers actually use, because some webmail providers still cap the size of an inline image.
3. Sending images through JSON APIs
JSON is text, so binary data cannot go in it raw. APIs that accept an image as part of a JSON request expect Base64: the client encodes the file, the server decodes it. The same pattern shows up in configuration files that need to carry a small binary blob as text, and in vision-model APIs, which accept Base64-encoded images directly. For this use, pick “Raw Base64” in the format picker — most APIs expect the encoded data without the data: header, and they will reject a string that still has it.
When not to inline an image
Base64 is a tool for small images, and knowing when not to use it matters as much as knowing how. A data URI cannot be cached separately from the page that contains it, so it is downloaded again every time that file changes. It must also be downloaded in full before the browser renders anything after it, which delays the first paint on a slow connection. And a 500 KB photo costs about 665 KB of page weight — before a single word of content.
Large files also hit practical limits: many editors slow down pasting a million-character string, some content systems cap field lengths, and a 5 MB image becomes roughly 6.7 MB of text. That is why this tool warns you above 5 MB instead of silently producing a string you cannot use. If the file is big, the Image Compressor on this site will usually shrink it far more than any encoding choice will.
Common mistakes to avoid
- Pasting a data URI where raw Base64 was expected. The
data:image/png;base64,prefix is part of the data-URI format, not part of the encoded data. If an API field expects plain Base64, decoding will fail. Grab the raw string instead — pick “Raw Base64” in the format picker. - Treating Base64 as encryption. It is not. Anyone can decode Base64 in a second, including the person you are hiding the picture from. Never use it to “protect” an image — use real access control, or just do not share the file.
- Inlining large photos. A 1 MB photo becomes 1.37 MB of text that cannot be cached separately and delays rendering. Inline icons and logos; link photographs.
- Breaking the string across lines. Base64 is one continuous string, and many strict decoders reject a line break in the middle or a missing
=at the end. Copy with the button instead of selecting the text by hand — the button copies the complete, unbroken string. - Forgetting the alt text. The HTML snippet fills in
altfrom the filename andwidthandheightfrom the image itself. If the filename is meaningless (IMG_2049.png), edit the alt text to say what the picture shows — screen readers and search engines both use it. - Encoding an image you have already compressed badly. Base64 faithfully encodes whatever bytes you give it, including a blurry, over-compressed JPEG. Fix the image first, then encode it.
Frequently asked questions
- Is this image to Base64 converter really free?
- Yes. There is no account, no subscription and no limit on the number of images you convert. The tool runs entirely in your browser, so there is nothing to pay for on our side either — no server time, no storage, no bandwidth.
- Are my images uploaded to a server?
- No. The file is read by your browser with the FileReader API and encoded on your own device. It never leaves your computer. You can test this yourself: load the page, turn off your Wi-Fi, and the converter still works.
- What image formats can I convert?
- JPG, PNG, WebP, GIF, SVG, AVIF, BMP, ICO and HEIC. Animated GIFs keep all their frames, because the tool encodes the file's bytes exactly as they are instead of redrawing the picture. SVG files pass through untouched, so the encoded result is byte-identical to the file you dropped in. HEIC photos from iPhones encode correctly too, although the browser cannot show a preview for them — the card says so instead of failing.
- Why is the Base64 string bigger than the image?
- Base64 represents every 3 bytes as 4 text characters, so the encoded output is about 33% larger than the file, plus up to two = padding characters and the 22-character data: prefix on a data URI. That is the price of using only safe text characters. For very small files the prefix matters more: a 70-byte 1×1 PNG becomes a 96-character Base64 string and a 118-character data URI.
- What is the difference between a data URI and raw Base64?
- A data URI is the raw Base64 string with a small header in front — data:image/png;base64, — that tells the browser what kind of file it is. Use the data URI when you paste into an HTML src attribute or a CSS url() value. Use raw Base64 when the other side expects just the encoded data, for example a JSON API field or a database column that already stores the file type separately.
- Can I convert several images at once?
- Yes — drop up to 30 images at once and each one gets its own card with a preview, dimensions, size comparison and copy buttons. Copy all grabs every image in the selected format, and Download all as .txt saves every result, labelled by filename, in one text file. If one file in the batch is not an image or cannot be read, only its card shows an error and the rest still encode.
- What is the maximum file size?
- 50 MB per image, with no limit on how many images you convert. Files over 5 MB still encode, but the tool warns you first: a 5 MB image becomes roughly 6.7 MB of text, which can be slow to paste into an editor. For large images, compressing first with the Image Compressor usually helps more than encoding the original.
Privacy
Because everything happens in your browser, we never see your images, we do not store them, and we cannot share them — there is nothing to share. No account means there is no profile to build and no email address to collect. Close the tab and the image is gone from memory.
Share this tool
Copy the link below and paste it anywhere — a chat message, an email, a document. Whoever opens it gets the same free tool, with no account and nothing to install.