Convert any image to a Base64 string or Data URI instantly. Supports PNG, JPG, GIF, SVG, WebP and more. Get ready-to-use code snippets for HTML, CSS, and JSON — 100% in your browser, nothing uploaded.
A Base64 image encoder converts binary image data (PNG, JPG, GIF, SVG, etc.) into a string of printable ASCII characters. The result — called a Data URI — lets you embed images directly into HTML, CSS, JSON, or any text-based format without needing a separate image file or HTTP request.
A typical Data URI looks like: data:image/png;base64,iVBORw0KGgo.... The browser can render this exactly like a regular image URL — it just reads the embedded data directly from the string.
Output Formats Explained
Data URI
The full Data URI string including the MIME type prefix. This is the most universally useful format and can be pasted directly into an src attribute or CSS url().
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
HTML <img> tag
A complete, ready-to-paste <img> element with the Base64 data URI as the src. Drop it into any HTML file and the image renders immediately — no external file needed.
The raw Base64 string (without the Data URI prefix) formatted as a JSON string value. Use this when transmitting images in API payloads or configuration files.
{ "image": "iVBORw0KGgoAAAANSUhEUgAA..." }
When NOT to use Base64 Images
Large images — Base64 adds ~33% size overhead. Embedding a 500 KB photo adds ~665 KB to your HTML file, blocking the entire page parse.
Images used on multiple pages — a regular image URL can be cached by the browser; a Base64 string embedded in HTML cannot be cached separately.
SEO-critical images — search engines may not index Base64-embedded images as effectively as externally hosted ones.
Frequently Asked Questions
There's no hard limit — the tool runs entirely in your browser, so it's limited only by your device's memory. In practice, encoding images larger than 2–5 MB is not recommended because the resulting Base64 string becomes extremely long and may cause performance issues when embedded in HTML or CSS files. For large images, use a regular image URL instead.
No — Base64 encoding is lossless. It converts the raw binary bytes of the image into text characters, then decodes them back to the exact same bytes. No pixel data is modified. The image quality is identical to the original.
Yes, but with caveats. Inline Base64 images avoid broken image links when email clients block external URLs. However, Gmail strips Base64 data URIs from HTML emails for security reasons. Most other clients (Outlook, Apple Mail, Thunderbird) support them. The safest approach for email is to use externally hosted images with absolute URLs, but Base64 works well for simple cases in clients that support it.
Use the Data URI inside a CSS url() function. Select the "CSS background" output tab in this tool to get the ready-to-use property. You can then add background-size, background-repeat, and other properties as needed. This technique is especially popular for small UI icons to avoid extra HTTP requests.
No — the entire encoding process runs in your browser using the FileReader API. Your image data never leaves your device. You can verify this by checking the browser's network tab — you'll see zero outbound requests when encoding an image.