Base64 & Data URI Converter
Convert images to Base64 Data URI strings for embedding in HTML and CSS, or decode a Base64 string back to a preview image. Supports WebP conversion with quality control.
Upload Image
Click to upload or drag & drop
PNG, JPG, GIF, WebP, SVG · Max 10 MB
Base64 Output
How to use the output:
In HTML <img>
<img src="data:image/png;base64,..." />
In CSS background
background-image: url("data:image/png;base64,...");In JavaScript
const img = new Image(); img.src = "data:image/png;base64,...";
Free Base64 Image Converter & Data URI Generator
Every image on the web is normally served as a separate HTTP request — your browser loads the HTML page, then fires off separate requests for each image, script, and stylesheet. This adds network latency, especially on slow connections or when a page has many small images. Base64 encoding is one way to solve this: instead of linking to an external image file, you embed the image data directly into your HTML or CSS as a long string of text called a Data URI.
The OmniWebKit Base64 Data URI Converter gives you a simple, two-way tool for working with Base64 image encoding. In Image → Base64 mode, upload any image and get a complete, ready-to-use Data URI string in seconds. In Base64 → Image mode, paste any Data URI string and see the decoded image rendered as a live preview, with a download button to save it as a file. Both modes work entirely in your browser — your images are never uploaded to any server.
The tool also includes optional WebP conversion. WebP is a modern image format developed by Google that produces files 25–35% smaller than equivalent JPEGs and PNGs at the same visual quality. Converting your images to WebP before encoding them as Base64 can significantly reduce the size of your embedded data strings.
How to Convert an Image to Base64 Data URI
Select the conversion direction
Use the tabs at the top to choose Image → Base64 (to encode an image file as a Data URI string) or Base64 → Image (to decode a Data URI string back into a viewable image).
Upload or paste your input
In Image → Base64 mode, click the upload area and select any image file from your computer (JPG, PNG, GIF, WebP, SVG up to 10 MB). In Base64 → Image mode, paste the full Data URI string — including the "data:image/png;base64," prefix — into the textarea.
Optionally convert to WebP
Toggle the "Convert to WebP" option before uploading to have the tool convert your image to WebP format before encoding. Use the quality slider to balance file size against image quality. 80–90% is ideal for most use cases.
Copy or download the result
In encoding mode, the Base64 Data URI appears in the output textarea on the right. Click Copy to copy the full string to your clipboard, or Download to save it as a file. In decoding mode, the rendered image appears on the right with a Download button.
When and Why to Use Base64 Data URIs
Base64 encoding is a useful technique in specific situations, but it is not always the right choice. Here is a guide to when it makes sense and when it does not.
✅ Small icons and UI elements
Small images like icons, logos, and loading spinners are good candidates. The encoded string is small enough that the size overhead of Base64 (about 33% larger than the original binary) is acceptable, and you save an HTTP round trip.
✅ Single-page apps with few images
If you have two or three images used continuously across your entire app, embedding them as Base64 ensures they are always available without a network request — no flicker, no loading state.
✅ Email HTML templates
HTML emails cannot reference external images reliably due to email client restrictions. Embedding images as Base64 Data URIs ensures they always render, regardless of the recipient's email client or network situation.
✅ CSS background images
You can embed small background textures, patterns, or decorative SVGs directly in your CSS using the url("data:image/svg+xml;base64,...") syntax, reducing the number of external files your stylesheet depends on.
❌ Large photographs
A 1 MB JPEG becomes 1.37 MB as Base64. For large images, the size overhead is significant, and modern HTTP/2 handles parallel requests efficiently anyway. Use external image URLs for large photos.
❌ Frequently changing images
If an image changes often, you lose the ability for the browser to cache it separately. An external image URL can be cached and reused across many pages; a Base64-embedded image is re-sent with every HTML page load.
Understanding the Base64 Data URI Format
A Base64 Data URI is a specific string format defined by RFC 2397. It always follows this structure:
data:[mediatype];base64,[encoded-data]
data:The URI scheme identifier. This tells the browser (or any parser) that what follows is inline data rather than an external resource URL.
[mediatype]The MIME type of the data. Common values: image/png, image/jpeg, image/webp, image/gif, image/svg+xml. This tells the browser how to interpret and render the data.
;base64,Indicates that the data is Base64-encoded. The comma separates the metadata from the actual data payload.
[encoded-data]The Base64-encoded binary content of the image. Base64 uses 64 ASCII characters (A–Z, a–z, 0–9, +, /) to represent arbitrary binary data in a text-safe format.
