Image To Base64 Converter
Data URI, HTML, CSS And Markdown
This image to base64 converter turns a picture into a data URI, an img tag, CSS or Markdown, and turns Base64 back into a picture. Everything runs in your browser. We upload nothing.
- FreePrice
- 8Types
- NoneSign-up
- NoneUploads
Image To Base64 Converter
Turn a picture into a data URI, or Base64 back into a picture
Your image shows here.
- Type
- —
- Pixels
- —
- Original size
- —
- Base64 size
- —
- Extra
- —
Ready. Choose an image or drop one here.
What An Image To Base64 Converter Does For You
A web page normally loads each picture as its own file. However, sometimes you want the picture inside the page itself. Then you need the picture as text.
An image to base64 converter does that. First, choose a picture. Then pick the format you want. The text appears at once, and you copy it with one click.
Also, it works in reverse. Paste a data URI or a plain Base64 string, and the picture appears. So you can see what a long string really holds, and download the image.
Everything runs in your browser. So your picture never leaves your device. That matters when it is a logo, a screenshot or a private photo.
What Is A Data URI
A data URI holds a file inside a web address. It starts with the word data, then the file type, then the word base64, then the encoded bytes. For example, a PNG starts with data:image/png;base64, and a long run of letters.
So the browser needs no second request. Then it reads the picture straight from the text.
For more detail, see: RFC 2397, the data URL scheme.
How Base64 Works
Base64 turns every three bytes into four letters and digits. So the text grows by about one third. For example, a 30 KB picture becomes about 40 KB of text.
Also, the tool shows the extra size, so you can judge the cost before you paste the text anywhere.
Convert An Image To Base64
First, drop a picture on the box, or click it to choose a file. Then pick a format. A data URI gives the full string. Plain Base64 gives only the encoded part.

The preview shows your picture. Then the numbers show its type, its size in pixels, its file size and its Base64 size.
Use A Data URI In HTML
Choose An HTML img tag. The tool writes the tag with the data URI, an alt text from the file name, and the width and height. Then you paste it into your page.
Use A Data URI In CSS
Choose CSS background image. The tool writes a background-image rule. So a small icon can sit inside your stylesheet. Then it loads with the CSS and needs no extra request.
Use A Data URI In Markdown
Choose A Markdown image. The tool writes the picture in Markdown form. Then some editors and note apps show the picture without any separate file.
Convert Base64 To An Image
Switch the direction to Base64 to image. Paste a data URI or a plain Base64 string. The tool checks it, reads the first bytes to find the type, and shows the picture.
Then press Download image to save it as a file. Because the tool reads the bytes, it names the file with the right ending, such as png or jpg.
Supported Image Types
The tool reads PNG, JPG, GIF, WebP, AVIF, BMP, ICO and SVG. Also, it finds the type from the file itself, not from the name. So a wrong ending does not fool it.
When To Use Base64 Images
Use them for tiny icons, email signatures and single file pages. First, they save one request for each picture. However, they also grow the text and skip the browser cache for the picture.
So keep them for small images.
When To Avoid Base64 Images
A big picture as Base64 makes a page heavy. Then the browser cannot cache it apart from the page. Also, it is harder to update later. So keep photos as normal files, and keep data URIs below about 100 KB.
Break Base64 Into Lines
Some systems, such as email, want lines of 76 characters. Then tick the line break box, and the tool wraps plain Base64 for you.
Check Private Images Safely
The picture never leaves your device. So you can convert private images, such as ids or screenshots, without a worry.
Safe By Design
First, the tool works in your browser. It sends nothing, and it stores nothing. So your picture stays yours.
On this page
- The tool
- What An Image To Base64 Converter Does For You
- Using The Converter, Step By Step
- What Sets This Converter Apart
- Habits For Using Base64 Images Well
- Common Base64 Image Mistakes This Tool Helps You Avoid
- Image To Base64 Converter Questions People Ask
- Handy Companions For Image Work
Keep going
Using The Converter, Step By Step
Four steps take you from a picture to text.
- 1
Pick a direction
Choose Image to Base64, or Base64 to image.
- 2
Add your picture
Drop a file on the box, or paste your Base64 text.
- 3
Choose the format
Pick a data URI, plain Base64, an img tag, CSS or Markdown.
- 4
Copy or download
Copy the text, save it as a file, or download the picture.
What Sets This Converter Apart
It goes both ways, it shows the cost, and it keeps your picture private.
Both directions
Turn a picture into Base64, and Base64 back into a picture.
Five formats
Data URI, plain Base64, img tag, CSS and Markdown.
Eight image types
PNG, JPG, GIF, WebP, AVIF, BMP, ICO and SVG.
Shows the size cost
See the file size, the Base64 size and the extra.
Live preview
See the picture before you copy anything.
Nothing leaves your tab
Your browser reads the file. We never see it.
Habits For Using Base64 Images Well
A few habits keep your pages fast.
- Keep images small. Stay below about 100 KB for each data URI.
- Compress first. Shrink the picture before you encode it, since Base64 adds a third.
- Use it for icons. Tiny icons and logos suit data URIs best.
- Keep photos as files. Big photos load better as normal files that the browser can cache.
- Prefer SVG for simple art. SVG stays small, and it scales to any size.
- Write an alt text. Check the alt text in the img tag, and make it describe the picture.
- Set the width and height. The tool adds them, so the page does not jump while it loads.
- Do not treat Base64 as secret. Anyone can decode it, so it hides nothing.
- Test in the page. Paste the result into your page and check that it shows.
- Keep the original. Save the source picture, so you can change it later.
- Mind private pictures. Do not paste a private picture into a public page.
Common Base64 Image Mistakes This Tool Helps You Avoid
Each of these quietly slows a page down.
Encoding big photos
A large photo makes the page heavy and slow.
Forgetting the extra third
Base64 text is about 33% bigger than the file.
A wrong file type
The type in the data URI must match the picture.
Broken lines
A data URI must stay on one line inside HTML and CSS.
Missing alt text
A picture without alt text hurts accessibility.
Trusting it as a lock
Base64 only changes the form. It does not protect anything.
Image To Base64 Converter Questions People Ask
Is this image to base64 converter free?
Yes. It costs nothing, needs no account and has no limits. It runs in your browser, so we have no server cost to pass on.
Does my image leave my device?
No. Your browser reads the file. Nothing reaches this site, and we keep nothing.
What is Base64?
It is a way to write bytes with 64 safe characters: letters, digits, plus and slash. It lets a picture travel as plain text.
What is a data URI?
It is a web address that holds the file itself. It looks like data:image/png;base64 followed by the encoded text.
How do I convert an image to Base64?
Drop the picture on the box, or click it to choose a file. The result appears at once. Then press Copy result.
How do I convert Base64 to an image?
Switch the direction to Base64 to image, and paste your text. The picture appears, and you can download it.
Which image types work?
PNG, JPG, GIF, WebP, AVIF, BMP, ICO and SVG. The tool finds the type from the bytes, not from the file name.
How big can the image be?
Up to 10 MB. Larger files would make the text too long to use.
Why is the Base64 bigger than the file?
Base64 uses four characters for every three bytes. So the text is about one third larger than the file.
What is the difference between a data URI and plain Base64?
A data URI adds the type and the word base64 in front. Plain Base64 is only the encoded part, with no prefix.
How do I use a data URI in an img tag?
Choose An HTML img tag. The tool writes the whole tag. Paste it into your page.
How do I use a data URI in CSS?
Choose CSS background image. The tool writes a background-image rule that you can paste into your stylesheet.
Can I use it in Markdown?
Yes. Choose A Markdown image. Some editors show the picture straight from the data URI.
Does it work with SVG?
Yes. The tool reads SVG files, shows them and writes a data URI for them. The preview treats the SVG as a picture, so no script in it can run.
Can I convert several images at once?
One at a time. Press Clear, then choose the next image.
Why can the browser not draw my image?
The file may be damaged, or its type may not suit your browser. Try a PNG or a JPG instead.
What does the line break option do?
It breaks plain Base64 into lines of 76 characters, the form that email and some older systems expect.
Should I use Base64 for big photos?
No. Big photos make a page heavy and the browser cannot cache them apart. Keep photos as files.
Does Base64 hide or protect an image?
No. Anyone can decode it in a second. It only changes how the picture is written.
Does the tool change or compress my picture?
No. The bytes stay exactly the same. The tool only writes them in another form.
Can I download the result?
Yes. Press Download text file to save the text, or Download image to save a decoded picture.
Does it work on a phone?
Yes. The panels stack and you can pick a photo from your gallery. So you can convert images on the go.
Handy Companions For Image Work
Converting is one step. These three tools help with the rest.
Base64 Encoder
Encode and decode text and files in Base64.
Open tool →Free Image Hosting
Upload a picture and get a link to share.
Open tool →Image Alt Text Checker
Find images with missing alt text on any page.
Open tool →
Ready To Convert An Image?
Drop a picture, pick a format, and copy the text. The converter is free, needs no account, and keeps every picture on your device.