Image to Base64
Turn an image into Base64 text you can paste into HTML, CSS, JSON or an API request: as a data URI, raw Base64, a CSS rule or an HTML tag.
Your files stay on your device. Nothing is uploaded.
Step 1: Add an image
Drag and drop an image here
or
PNG, JPG, WebP, GIF, SVG, AVIF or BMP. Up to 10 MB.
Step 2: Output format
Step 3: Encode
Starting…
How to convert an image to Base64
-
Add your image
Click Choose image or drag a PNG, JPG, WebP, GIF, SVG, AVIF or BMP into the box.
-
Choose the format
Pick Data URI, Base64 only, CSS background or HTML img tag.
-
Copy or download
Click Convert to Base64, then copy the text or download it as a TXT file.
About this tool
What Base64 is
Base64 writes binary data, such as an image, using only 64 safe text characters. That lets an image travel inside text: an HTML page, a CSS file, JSON or an email.
It makes files about a third larger
Base64 text is about 33% larger than the image file. Use it for small icons and images under a few kilobytes; larger images load faster as normal files, which browsers can also cache.
The four formats
Data URI: data:image/png;base64,... for src and url(). Base64 only: the raw code for APIs. CSS: a ready background-image rule. HTML: a ready <img> tag with alt text from the file name.
Privacy
This tool runs in your browser, on your own device. Your files and text are not uploaded to our server and we cannot see them. When you close or reload this tab, they are cleared, along with the results.
Frequently asked questions
Is there a size limit?
Up to 10 MB per image. Very long text can make some editors slow, which is another reason to keep Base64 for small images.
How do I turn Base64 back into an image?
Paste a data URI into your browser's address bar and the image opens; you can then save it.
Is my image uploaded?
No. Everything happens in your browser, so your images never leave your device.
Can I encode text instead of an image?
A Base64 text encoder is planned for the developer tools.
Related tools
- SVG › PNG SVG to PNG Turn SVG drawings into sharp PNG images at any size.
- PNG › ICO Favicon generator Make favicon.ico and app icons from one image.
- IMG › Smaller Image compressor Make JPG, PNG and WebP images smaller.
- PNG › WebP PNG to WebP Convert PNG images to smaller WebP files.
- RESIZE Image resizer Resize JPG, PNG and WebP images by pixels or percentage.
- PNG › SVG PNG to SVG Trace a PNG or JPG into a scalable SVG drawing.
- HEX ⇄ RGB HEX to RGB converter Convert colour codes between HEX, RGB and HSL.
- COLOR Color picker from image Pick colors from an image and copy HEX, RGB and HSL codes.