Convert images to Base64 encoded strings.
Quick answer
About one third bigger: every 3 bytes of the image become 4 text characters. A 100 KB image becomes 136,536 characters. That is why Base64 suits tiny icons and API payloads but not photographs.
| Image size | Base64 characters | Increase |
|---|---|---|
| 1 KB | 1,368 | 33.6% |
| 10 KB | 13,656 | 33.4% |
| 100 KB | 136,536 | 33.3% |
| 1 MB | 1,398,104 | 33.3% |
These figures are computed with the same formulas as the Image to Base64 above. Change the inputs in the tool to see your own result.
Image to Base64 converts an image into a text string you can paste into HTML, CSS, JSON, Markdown or an API request, and converts Base64 back into an image. Choose from five ready-to-use outputs: a data URI, the raw Base64, an HTML img tag, a CSS background-image line or a Markdown image. The tool shows the size change and warns when an image is too large to inline sensibly. Everything runs in your browser and nothing is uploaded.
Made for everyone. Typical uses:
A 4 KB PNG icon becomes about 5.5 KB of Base64 text, which you can paste as an img src or CSS url() so no separate file is loaded. Pasting a string that starts with iVBORw0KGgo shows a PNG preview and lets you download it as decoded-image.png.
Base64 makes data about a third larger and cannot be cached separately, so it suits small images only. Images over 10 MB are refused. Base64 is not encryption: anyone can decode it.
Accuracy: Images are processed with the browser's own image engine and tested with real photos and graphics. Check the result before you use it.
Expert Tip
Inline only small icons and logos, ideally under 10 KB. For photographs, a normal image file loads faster and can be cached.
Base64 is a way of writing binary data, such as an image file, using only ordinary text characters. Encoding a picture as Base64 lets you put it directly inside text: an HTML page, a CSS file, a JSON message, an email or a Markdown document, with no separate image file to load. In HTML it looks like a very long src attribute that begins with data:image/png;base64, followed by the encoded data. That whole string is called a data URI.
The tool encodes any image in your browser and shows the result in five ready-to-use forms: a data URI, the raw Base64 string, an HTML img tag, a CSS background-image line and a Markdown image. It also works in reverse: paste Base64 or a data URI and it shows the picture and lets you download it.
Base64 images are useful in a few specific situations.
Base64 makes data about a third bigger: three bytes become four characters. A 30 KB image becomes about 40 KB of text, and that text cannot be cached separately from the page that contains it, cannot be lazy-loaded and slows the page's first render. For photographs and anything over about 10 to 20 KB, a normal image file that the browser can cache and load in parallel is better. The tool warns you when a file is over 100 KB.
Compress and resize first if you must embed: the Image Compressor and Image Resizer can shrink a picture before it is encoded, and SVG to PNG helps if your logo is a vector. For vectors, embedding the SVG code directly is often smaller than any Base64 version.
Choose the format that matches where the text will go. The data URI is what you paste into an img src or a CSS url(). The raw Base64 is what many APIs ask for, without the data: prefix. The HTML option gives a complete img tag with alt text taken from the file name, which you should replace with a real description for accessibility. The CSS option gives a background-image declaration. The Markdown option gives an image link for documents that support data URIs.
Click the text box to select all of it, or use the copy button. Very long strings are normal: a small icon can still be several thousand characters.
The second tab reverses the process. Paste a Base64 string, with or without the data:image prefix, and the tool checks it, detects the type from the first bytes if the prefix is missing, shows a preview and lets you download the file with the right extension. If the text is not valid Base64 image data, you get a clear message instead of a broken picture. Line breaks and spaces inside the pasted text are ignored, which helps with strings copied from emails or logs.
Encoding and decoding happen in your browser; the image and the text are never sent to a server. Files are limited to 10 MB because larger images produce text that is too big to copy. Base64 is not encryption: anyone can decode it, so do not treat it as a way to hide a picture. For more on image formats and file sizes, read JPG vs PNG vs WebP.
What Base64 and data URIs are, the 33% size overhead, five ready-to-paste formats, and the cases where embedding helps or hurts.
A practical process for shrinking website images: right dimensions, right format, sensible quality, lazy loading and a checklist to verify the result.
Base64 is not encryption and a hash cannot be reversed. See what each does, where JWTs and URL encoding fit, and how to pick MD5, SHA-256 or a password hash.
Explore more in Image Tools, read the guides and articles, or see how we test our tools.
Format, beautify, and validate JSON data with proper indentation.
Best for formatting minified JSON from APIs for readability
Encode and decode Base64 strings instantly.
Best for encoding binary data for email and web transmission
Format and beautify messy HTML code with proper indentation.
Best for beautifying minified HTML for editing
Compress images to reduce file size. Adjustable quality, instant preview and download.
Best for shrinking photos before uploading them to a website or CMS
Convert SVG vector images to PNG.
Best for using a logo where SVG is not accepted, such as email, social networks and presentations
Generate QR codes for URLs, text, and more.
Best for linking printed menus, posters and flyers to a web page