Image to Base64 — convert any image instantly
Drop a PNG, JPEG, GIF, WebP, SVG or BMP image and get its Base64 string and data URL immediately, with ready-to-paste HTML, CSS and Markdown snippets. Everything happens in your browser — your image is never uploaded. A reverse decoder below turns Base64 back into a viewable, downloadable image.
or tap to choose a file — PNG, JPEG, GIF, WebP, SVG, BMP, ICO, AVIF · up to 20 MB · you can also paste (Ctrl/⌘+V) an image from the clipboard
No image handy? Try a sample
Each sample is drawn live in your browser and converted on the spot — a quick way to see every output format.
Base64 → Image (reverse)
Paste a Base64 string or a full data URL and see the image it contains. The format is detected from the file's magic bytes — the header inside the data itself — and the recovered file can be downloaded.
Your session
Images you convert during this visit, kept only in this tab's memory — restore one to get its outputs back, or pin a conversion you want to keep handy. Nothing here is stored or sent anywhere; very large conversions are listed by name and size only.
Recent conversions
No conversions yet — drop an image above and it will appear here.
Pinned conversions
No pinned conversions yet — convert an image, then use “Pin this conversion”.
Your tools
Tools you have actually opened this session, plus any you pin as favorites. The lists live in this browser session only.
Recently used
No other tools opened yet this session — tools you visit will appear here.
Favorite tools
No favorites yet — pin a tool below.
All developer & image tools
How to convert an image to Base64
- Drop your image onto the tool, tap the drop zone to choose a file, or paste an image straight from the clipboard with Ctrl/⌘+V.
- The conversion runs instantly and locally — the file is read by your browser, never uploaded — and the preview confirms you picked the right image.
- If you need a different format, switch the output format to PNG, JPEG or WebP and set the quality. JPEG has no transparency, so transparent pixels are flattened onto white.
- Copy the output you need: the full data URL for an <img> src, the raw Base64 for an API or JSON payload, or the ready-made HTML, CSS and Markdown snippets.
Worked example
Try it yourself: the 1×1 transparent pixel sample above produces exactly this string.
Anatomy of a data URL
A data URL has three parts: the data: scheme, the file's MIME type (image/png, image/jpeg, …), and the marker ;base64, followed by the encoded bytes. Browsers accept data URLs almost anywhere a normal URL works — image sources, CSS backgrounds, favicons, even a link's href for downloads. Because the data travels as text, it can live inside HTML, CSS, JSON and SVG files that could never hold raw binary.
Which output format should you pick?
| Format | Transparency | Best for | Watch out |
|---|---|---|---|
| PNG | Yes | Logos, icons, screenshots, line art | Large for photos — files (and Base64) balloon |
| JPEG | No | Photos and photo-like images | Lossy; transparent areas flatten to white here |
| WebP | Yes | Photos and graphics on the modern web | Older email clients may not render it |
| GIF | Yes (1-bit) | Simple animation (kept in Original mode) | Re-encoding to another format keeps only the first frame |
| SVG | Yes | Vector logos and icons that must stay crisp | Re-encoding rasterizes it — keep Original to stay vector |
Data URLs: when they help, when they hurt
Embedding an image as a data URL saves an HTTP request and guarantees the image loads with the page — handy for small icons, logos, email graphics and single-file documents. The costs are real, though: Base64 inflates the image by about 33%, the encoded text cannot be cached separately from the page, and browsers cannot lazy-load or prioritize it. A good rule of thumb: data URLs for images under roughly 10–20 KB, regular files for everything bigger — and if your image is oversized to begin with, run it through the Image Compressor first.
What to do with your Base64 next
Encoded images usually end up as an <img> src or CSS background (both snippets are generated above), inside a JSON payload for an API, as a favicon, or in an email template where external images get blocked. The “Send output to…” bar carries the raw Base64 into the Base64 Encoder/Decoder for a round-trip check, or the data URL into the QR Code Generator — and if another tool chains a data URL into this page, it is loaded and previewed automatically.
Frequently asked questions
How do I convert an image to Base64?
Drop the image onto this page (or tap the drop zone and choose it). The tool reads the file locally in your browser and shows the Base64 string, the full data URL, and ready-made HTML, CSS and Markdown snippets you can copy with one click. No upload happens at any point.
What is a data URL (data URI)?
A data URL embeds a file directly in a web page using the format data:<mime-type>;base64,<base64-data> — for example data:image/png;base64,iVBORw0KGgo… You can use it as an <img> src, a CSS background-image, or anywhere a URL is accepted, so the image needs no separate file or HTTP request.
Which image formats are supported?
Any format your browser can read: PNG, JPEG, GIF (including animated GIFs — the animation is preserved in the raw Base64), WebP, SVG, BMP, ICO and AVIF. You can also re-encode the output to PNG, JPEG or WebP with a quality setting; note that re-encoding an animated GIF or an SVG rasterizes it to a single still frame.
Is my image uploaded to a server?
No. The conversion uses the browser's built-in FileReader and Canvas APIs on your device. Your image is never uploaded, stored or tracked — you can verify this by loading the page and then converting an image with your network disconnected.
Why is the Base64 output bigger than my image file?
Base64 encodes every 3 bytes of the file as 4 characters, so the string is about 33% larger than the original file, plus a short data: prefix for a data URL. That overhead is the trade-off for embedding the image as text: fewer HTTP requests, but a larger HTML or CSS file.
When should I use a Base64 data URL instead of an image file?
Data URLs suit small images — icons, logos, tiny placeholders and email graphics, roughly under 10–20 KB — where saving an HTTP request matters more than the 33% size increase. Large photos are usually better as separate files: they can be cached, lazy-loaded and compressed independently, while a data URL is re-downloaded with every page that contains it.
How do I turn Base64 back into an image?
Use the Base64 → Image panel above: paste a Base64 string or a full data URL, and the tool detects the image format from the file's magic bytes, shows a live preview and lets you download the recovered image file.
Can I convert an SVG to Base64?
Yes — drop the .svg file and you get its Base64 and a data:image/svg+xml data URL. If you re-encode it to PNG, JPEG or WebP the vector is rasterized at its natural size, so for crisp results keep the original format unless you specifically need a raster.
What is the maximum image size?
Files up to 20 MB are accepted, but very large images produce multi-megabyte Base64 strings that are slow to copy and paste and bloat any page you embed them in. For anything over a few hundred KB, consider the suite's Image Compressor first.
Related developer & image tools
About this tool
The Image to Base64 converter is one of 45 free utilities in the Online Utilities Suite at dev.conversiontools.online. Every tool runs entirely in your browser — your files are never uploaded, stored or tracked — so conversions are instant and private, even for large images.
Privacy
This page processes everything locally in your browser: no account, no uploads, and nothing you convert here is stored or sent to a server. Advertising on this site is served by Google AdSense, which may use cookies to personalize ads; you can opt out of personalized advertising in your Google ad settings.