This image to Base64 converter encodes a picture as text, so it can be embedded directly in HTML, CSS, JSON or an email template instead of being loaded as a separate file.
How to use the Image to Base64 Converter
- 1 Drop an image on the box or click to choose it.
- 2 Pick the output: data URI, Base64 only, CSS or HTML.
- 3 Click Copy and paste it into your code.
Worked examples
Input: icon.png, 1 KB
Result: background-image: url("data:image/png;base64,iVBOR…")
Saves one request for a tiny image.
Input: avatar.jpg
Result: A Base64 string for an API field
What is Base64 image encoding?
Base64 turns binary data, such as an image, into plain text made of letters, digits, plus and slash. A data URI wraps that text with the image type, for example data:image/png;base64,iVBORw0…, so browsers can display it anywhere a normal image URL works: in an <img> tag, a CSS background-image, an SVG or an email.
When to use the image to Base64 converter
- Small icons and logos in CSS or HTML, to save a separate download.
- Email templates, where linked images may be blocked.
- APIs and JSON, which carry only text.
- Single-file HTML pages that must work offline.
When not to use Base64
Base64 text is about 33% larger than the original file, and an embedded image cannot be cached separately by the browser. For photos and anything larger than a few kilobytes, a normal image file loads faster. The converter shows the size before and after so you can judge.
Output formats
- Data URI: the complete
data:string, forsrcandurl(). - Base64 only: just the encoded text, for APIs that store the type separately.
- CSS: a ready
background-imagedeclaration. - HTML: a ready
<img>tag (add your own alt text).
Private by design
Your images are processed by your own browser and never uploaded to a server, so they stay on your device. There is no watermark, no sign-up and no limit on how many images you convert.
Frequently asked questions
Why is the Base64 text bigger than the image?
Base64 uses 4 characters for every 3 bytes, so it is about 33% larger.
Which image formats work?
Any format your browser can open, including PNG, JPG, GIF, WebP, SVG and ICO.
Should I embed large photos as Base64?
Usually not: they become a third larger and cannot be cached. Use Base64 for small icons and logos.
Is my image uploaded?
No. It is encoded in your browser.
Related tools
Image to PDF Converter
Combine JPG, PNG and WebP images into one PDF, one image per page. Reorder pages and choose A4, Letter or the image size.
JPG to PDF Converter
Convert JPG photos to PDF: one or many JPG images into a single PDF, in the order you choose. Free, no upload.
PNG to PDF Converter
Convert PNG images and screenshots to PDF without quality loss, one or many pages in one file. Free, no upload.
PNG to JPG Converter
Convert PNG images to JPG with adjustable quality and a background colour for transparent areas. Batch conversion, no upload.
JPG to PNG Converter
Convert JPG (JPEG) images to lossless PNG in your browser. Batch conversion, no quality loss from re-saving, no upload.
WebP to PNG Converter
Convert WebP images to PNG, keeping transparency. Open WebP pictures in any program. Batch conversion, no upload.