Image to Base64 Converter
Encode an image as a Base64 data URI.
Data URIs embed images directly in code — handy for small icons and single-file demos.
How to use
- Choose an image file from your device.
- It is encoded to a Base64 data URI instantly.
- Copy the URI for use in HTML/CSS.
About this tool
To base64 encode an image, choose the file above: the converter reads it locally and returns the full data URI, ready to paste anywhere an image URL would go. The part after the comma is the raw Base64 string; the data: prefix in front tells the browser the image type.
Base64 inflates size by ~33%, so this suits small images, not photos.
Your image is read locally and never uploaded anywhere.
How it works
A data URI embeds a file directly as text: data:[mime-type];base64,[payload]. For a PNG that looks like data:image/png;base64,iVBORw0KGgo... — the browser decodes the Base64 back to bytes and renders it exactly like an image loaded from a URL.
Base64 inflates size by about 33%, and the string cannot be cached separately from the page, so data URIs suit small assets: icons, tiny logos, one-off thumbnails. A 2 MB photo as a data URI bloats the HTML and blocks rendering — link large images as files instead.
Because this converter runs entirely in your browser, the image never leaves your device — unlike server-side converters that upload your file first.
If you only need the encoded bytes — for a JSON field or an API payload — take everything after the comma in the data URI: that part is the plain Base64 string. Keep the full data URI, prefix included, when pasting into an <img> src or a CSS url().
Worked examples
Inlining an icon in CSS: Convert a 2 KB arrow icon and paste background: url(data:image/png;base64,iVBOR...) into your stylesheet — one fewer HTTP request, and no broken image path to debug later.
Images in email drafts: Email clients often block external images but tolerate data URIs. Embed the logo directly so the draft looks right in the inbox preview.
Quick reference
| Part | Example |
|---|---|
| Scheme | data: |
| MIME type | image/png (or image/jpeg, image/webp) |
| Encoding marker | ;base64, |
| Payload | iVBORw0KGgo… (the encoded bytes) |
Frequently asked questions
How do I base64 encode an image?
Choose the image file above. It is encoded instantly in your browser and shown as a data URI — click Copy data URI to take the full string.
What is the difference between a Base64 string and a data URI?
The Base64 string is just the encoded bytes as text. A data URI adds a prefix such as data:image/png;base64, so a browser can use it directly as an image source in HTML or CSS.
When should I use data URIs?
Tiny icons and graphics where an extra HTTP request costs more than the size overhead.
Why is the output bigger?
Base64 encoding adds about one third to the file size.
Is my image uploaded?
No — processed 100% on your device.
First time embedding? Read the step-by-step guide →
More free tools
Base64 Encode / Decode
Encode text to Base64 or decode it back.
Color Converter (HEX ↔ RGB)
Convert HEX to RGB and back, with live preview.
Unit Converter
Convert length, weight and temperature instantly.
Currency Converter
Daily ECB reference rates for 26 currencies — updated once per business day.
World Clock & Time Converter
Current time in major cities, plus converter.
Meeting Time Planner
Find overlap hours across time zones.