Use this free Image to Base64 converter to convert any image to Base64 text in one click. You get the data URI, the plain Base64 string, a ready HTML img tag and CSS background code, each with its own copy button. The image is encoded in your browser and never uploaded.
Private by design: your files are processed in your browser and never uploaded to any server.
How to convert image to Base64
- Add your image. Drag it into the box or click Choose image. PNG, JPG, WebP, GIF, SVG and ICO all work.
- Copy the code you need. Use the data URI, the plain Base64 string, the HTML img tag or the CSS background line. Each has its own copy button.
- Paste it into your project. Use it in HTML, CSS, emails, JSON or API requests.
Two-way tool: image to Base64 and back
This converter works both ways. Use the Image → Base64 tab to get the code, then click Decode it back to check it instantly in the Base64 → Image tab. You can also open our Base64 to Image converter directly.
- Six ready-to-paste formats: data URI, Base64 only, HTML <img> tag with width and height, CSS background, Markdown and JSON
- Download the code as a .txt file
- Shows the image size in pixels and how much bigger the text is than the file
- Try an example image if you just want to see how it works
Why convert to Base64?
- Embed images in code. Put small icons and logos straight into HTML or CSS, with no separate image file to load.
- HTML emails. Some email builders need images as Base64 so they show without being blocked.
- APIs and JSON. Many APIs, including AI image APIs, expect images sent as Base64 text.
What is Base64?
Base64 is a way of writing binary data, such as an image, using only 64 safe text characters: A–Z, a–z, 0–9, plus (+) and slash (/). Because the result is plain text, it can be placed inside HTML, CSS, JSON, XML or an email without breaking anything. A data URI adds a short label in front, for example data:image/png;base64,, so the browser knows the image type and can display it directly.
The trade-off is size: Base64 text is about 33 percent larger than the original file. That is why it is best for small images such as icons, logos and placeholders.
Common uses
- Embedding small icons and logos directly in HTML or CSS.
- Adding images to HTML email templates.
- Sending images to APIs that expect Base64 input.
- Storing small images inside JSON or databases.
Features of this Image to Base64 converter
- Four code formats: data URI, plain Base64, HTML img and CSS background.
- One-click copy: every box has its own copy button.
- Live preview: see the image and its encoded size.
- No upload, fully private: files are processed on your own device and never sent to a server.
- Free, with no limits: no sign-up, no watermark and no daily cap.
- Works everywhere: Android, iPhone, Windows, Mac and Linux, in any modern browser.
Tips
- Base64 makes files about 33 percent bigger than the original image. Use it for small images such as icons and logos.
- For large photos, a normal image file loads faster than Base64 code.
Is it safe to use?
Your files are processed in your web browser, on your own device. Nothing is uploaded to our server, nothing is stored, and nobody else can see your images.
Add this image to Base64 converter to your website (free widget)
Do you run a blog, school, coaching or business website? You can add this free image to Base64 converter to your own page as a widget in under a minute. It works just like the tool above: files are processed in your visitor’s browser and never uploaded, and the widget shows no ads, only a small “Powered by All Tool Widgets” link.
- Open Get this tool as a free widget for your website just below the tool.
- Pick a button colour that matches your brand and click Copy code.
- Paste the code into your page: a Custom HTML block in WordPress, an HTML/JavaScript gadget in Blogger, or an Embed HTML element in Wix and Shopify.
See all embeddable tools on our free widgets page.
Frequently asked questions
Is this Image to Base64 converter free?
Yes. It is completely free, with no sign-up, no watermark and no limit on the number of files.
Are my files uploaded to a server?
No. Your files are processed inside your browser and never leave your device.
Does it work on my phone?
Yes. It works in Chrome, Safari, Edge and Firefox on Android and iPhone, with nothing to install.
Which image formats are supported?
PNG, JPG, WebP, GIF, SVG, ICO, BMP and AVIF. The data URI automatically uses the right image type.
Can I use the Base64 code in an email?
Yes. Paste the data URI into the src of an img tag in your HTML email. Some email apps block large Base64 images, so keep images small.
What is a data URI?
A data URI is Base64 text with a short prefix such as data:image/png;base64, so browsers know the image type. You can use it directly in an img src or CSS url().
Why is the Base64 text bigger than my image?
Base64 represents binary data with text characters, which makes it about 33 percent larger than the original file.
Can I add this image to Base64 converter to my website?
Yes. Copy the free widget code from the box below the tool and paste it into any web page. The widget is free for personal and commercial websites, shows no ads and keeps your visitors’ files private.
You may also like: PNG to JPG converter, JPG to PNG converter.