How to Convert an Image to Base64
- Drop an image onto the box, or click to browse for a file.
- The tool shows a preview, the file type and how long the encoded text is.
- Pick the output you need: Copy data URI, Copy raw Base64, Copy CSS background-image or Copy HTML <img> tag. A message confirms when the text is on your clipboard.
- For large results, use Download .txt to save the data URI as a text file.

What Is Base64?
Base64 is a way of writing binary data, such as the bytes of an image, using only 64 safe text characters: A–Z, a–z, 0–9, plus (+) and slash (/), with equals signs (=) as padding at the end. Every 3 bytes of the file become 4 characters of text. Because of this, Base64 text is always about 33 percent larger than the original file, plus a few characters for the header.
Base64 is not encryption and offers no protection: anyone can decode the text back into the original image.
Data URI or Raw Base64?
A data URI is Base64 text with a short header that tells the browser what kind of file it is, for example data:image/png;base64,iVBORw0KGgo…. You can paste it anywhere a URL is expected: in an <img src> attribute, in a CSS url() or in a Markdown image.
Raw Base64 is only the encoded characters without the header. Use it when an API, database field, JSON payload or configuration file asks for "Base64-encoded image data" and stores the file type separately.
When Data URIs Make Sense
- Small icons and logos of a few kilobytes, so a page needs fewer separate requests.
- Single-file HTML pages and reports that must work offline or be sent as one file.
- CSS backgrounds and patterns bundled directly into a stylesheet.
- Test data and prototypes, where uploading an image somewhere would be extra work.
When to Avoid Them
For large photos, a normal image file is almost always better. Base64 text is a third larger, it cannot be cached separately by the browser, and it makes HTML and CSS files heavy to download and slow to edit. Many email programs, including Gmail and Outlook, do not display data URI images in messages, so use attached or hosted images for email instead. As a rule of thumb, keep data URIs under about 10 KB.
To help, the tool warns you when an image is over 5 MB. Above 20 MB the text is not displayed in the box, because showing millions of characters can freeze the page, but you can still copy it or download it as a .txt file. Files over 100 MB are refused.
Tips
- Compress or resize the image before converting it, with the Image Compressor or Image Resizer, to keep the text short.
- SVG icons can be embedded as Base64, but they are often smaller when embedded as plain SVG code.
- If the copy buttons are blocked by your browser, click in the text box, select all with Ctrl+A (⌘+A on Mac) and copy with Ctrl+C.
Your Image Never Leaves Your Browser
The file is read and encoded by your browser using the standard FileReader interface. Nothing is uploaded to Preslo or to anyone else, so you can safely convert private or unpublished images. No account is needed.
Frequently asked questions
Which image formats are supported?
Any image file your browser recognizes, including JPG, PNG, GIF, WebP, SVG, ICO and BMP. The data URI keeps the original file type.
What is the difference between a data URI and raw Base64?
A data URI starts with a header such as data:image/png;base64, and can be used directly as an image URL. Raw Base64 is only the encoded characters, for APIs and data fields that store the file type separately.
Does Base64 make the image bigger?
Yes. Base64 text is about 33 percent larger than the original file, which is why it suits small images better than large ones.
Is Base64 a form of encryption?
No. It is only an encoding. Anyone can turn the text back into the original image, so do not rely on it to protect sensitive content.
Why is the text not shown for my large image?
For files over 20 MB, displaying the text could freeze the page, so it is hidden. You can still copy it or download it as a .txt file.
Can I use a data URI in an email?
Not reliably. Many email programs, including Gmail and Outlook, block or ignore data URI images. Use attached or hosted images in emails instead.
Is my image uploaded anywhere?
No. The image is processed on your device and never sent to a server.