Image to Base64 Converter
Use this free image to Base64 converter to turn an image into a Base64 string, Data URI, CSS background value, HTML img tag, or JSON payload. The conversion runs in your browser, so the image you select is not uploaded.
Image to Base64 Converter
Drop your image below or click to browse. Your file never leaves your device.
Drop your image here
or click to browse your files
JPG · PNG · GIF · WebP · SVG · BMP · ICO · Max 10 MBConverting…
Base64 to Image (Reverse)
Paste a Base64 string or Data URI to preview and download the decoded image.
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data — such as image files — as a string of ASCII characters. It was originally designed to allow binary data to be safely transmitted over systems built to handle text only, such as email (MIME) and HTTP headers. The name comes from the fact that it uses 64 printable characters (A–Z, a–z, 0–9, +, and /) to represent binary data.
Every 3 bytes of binary data are encoded into 4 Base64 characters. This means Base64 encoding increases data size by approximately 33% — a 100 KB image becomes roughly 133 KB as a Base64 string. Despite the size overhead, Base64 is extremely useful in web development because it allows binary files to be embedded directly into text-based formats like HTML, CSS, JSON, and XML.
Output Formats Explained
Data URI
Embeds the Base64 string directly into a URL: data:[mediatype];base64,[data]. Can be used anywhere a regular URL is accepted — HTML src attributes, CSS url() values, JavaScript, and more.
Raw Base64
The encoded string without any prefix. Useful for storing in databases, passing through APIs, or using in systems that add their own prefix.
CSS Background
Formats as a complete CSS background-image property. Paste directly into any CSS file to embed the image without a separate HTTP request.
HTML img Tag
Wraps the Data URI in a complete HTML img element with src, alt, width, and height attributes pre-filled. Paste directly into any HTML file.
JSON
Outputs the image as a JSON object with the Base64 data as a string value — suitable for API payloads and JSON-based data transfer.
When to Use Base64 Images
- Small icons and logos under ~5 KB where the HTTP request overhead exceeds the 33% size penalty.
- Email HTML templates — many email clients block externally hosted images but display Base64-embedded ones correctly.
- API payloads — transmit an image alongside other data in a single JSON request.
- Offline / PWA applications — embed images as Base64 to ensure availability without a network connection.
When NOT to Use Base64
Avoid Base64 for large images (over 10–20 KB). The 33% size increase outweighs the saved HTTP request, and Base64 strings cannot be cached by the browser separately from the HTML or CSS file they are embedded in. For most production websites, CDN-hosted images are the right choice for anything larger than a small icon.
Frequently Asked Questions
Explore All NerdyTools By Categories
Find the right tool for any task — free, fast, and no sign-up required
Thank you for reading this post, don't forget to subscribe!