Image to Base64
Convert images to Base64 strings and Data URLs — free, instant, browser-based
Upload Image
Drag & drop or click to upload
PNG, JPG, GIF, SVG, WebP, BMP
Includes MIME type prefix — use directly in HTML/CSS src
Upload an image to see the Base64 output…String only, no prefix — use in code that adds the header
Upload an image to see the Base64 output…Ready to paste into a CSS stylesheet rule
Upload an image to see the Base64 output…Copy directly into HTML markup
Upload an image to see the Base64 output…Free Image to Base64 Converter — Convert Any Image to a Base64 Data URL Instantly
Base64 is a way of encoding binary data — like an image file — into a string of printable ASCII characters. This is useful in many web development and programming scenarios where you need to embed image data directly into code, rather than linking to a separate file. The OmniWebKit Image to Base64 converter does this in your browser, instantly, without any server upload or file size limit.
Upload any image (PNG, JPG, WebP, GIF, SVG, BMP), and the tool immediately produces four ready-to-use output formats: the full Data URL (with MIME type prefix), the raw Base64 string, a CSS background-image declaration, and an HTML <img> tag with the Base64 value embedded. Copy any format with one click.
The tool also works in reverse: switch to "Base64 → Image" mode, paste any Base64 string or Data URL, and the tool decodes it back into a visible image preview that you can save as a file. This is useful for debugging email templates, API responses, or any system that stores images as Base64 strings.
What is Base64 Encoding?
Base64 is an encoding scheme that converts binary data into a text format. Computers store images as binary data — sequences of 1s and 0s — which cannot be reliably transmitted through all text-based protocols. Base64 solves this by mapping every 3 bytes of binary data to 4 printable ASCII characters using a fixed alphabet of 64 characters (A–Z, a–z, 0–9, +, /, and sometimes =).
The resulting string can be safely included in HTML attributes, CSS style rules, JSON objects, XML documents, email bodies, and any other text-based format — without worrying about character encoding, binary corruption during transfer, or file path dependencies.
Base64 Size Penalty
Base64 encoding increases file size by approximately 33%. A 100 KB image becomes roughly 133 KB as a Base64 string. This is the trade-off for embedding the image directly in text. For large images used repeatedly across a website, external files (referenced by URL) are more efficient. Base64 is best used for small images — icons, logos, data URIs — where the HTTP request overhead would be higher than the 33% size penalty.
When to Use Base64 for Images — Real-World Use Cases
Email Templates and Newsletters+
CSS Inline Icons and Small UI Graphics+
Single-File HTML Documents+
API Payloads and JSON Data+
Database Storage+
Canvas and Dynamic Image Generation+
Base64 Output Formats Explained
Data URL
data:image/png;base64,iVBORw0KGgo...The complete Data URL includes the MIME type prefix (data:image/png;base64, or data:image/jpeg;base64, etc.). This is the most complete and portable format. You can use it directly as the src attribute value in an HTML <img> tag, as a CSS background-image value, or wherever a URL is expected. The MIME type tells the browser what kind of binary data follows.
Raw Base64 String
iVBORw0KGgo...The raw Base64 string is the encoded data without the data: prefix. Use this format when you are passing the image to an API that expects raw Base64 (not a Data URL), when constructing your own data URI in code, or when storing in a database field that handles its own type metadata.
CSS background-image
background-image: url("data:image/png;base64,...");Ready to paste directly into a CSS rule. Copy this output and paste it into your stylesheet — the image is embedded without any separate file. This is the standard way to embed icons and small graphics directly in CSS. Works in all modern browsers.
HTML <img> tag
<img src="data:image/png;base64,..." alt="image" />A complete, ready-to-use HTML image element with the Base64 Data URL as the src. Copy and paste this directly into any HTML file. The image will render in any browser that supports Data URLs (all modern browsers, and most legacy ones too).
