Drop your images here
or browse files from your device
No image yet
Upload an image to see the Base64 output
Base64 encode images instantly — copy as Raw Base64, Data URI, CSS, HTML, JSON or Markdown
or browse files from your device
Upload an image to see the Base64 output
Convert image to base64 online with this free image to base64 converter. Base64 encode an image (JPG, PNG, SVG, WebP, GIF, BMP) in one click and copy the output as Raw Base64, Data URI, CSS, HTML, JSON, Markdown or SVG <image>. Everything runs in your browser — no uploads, no signup, no watermarks, unlimited free use.
Image to base64 is the process of converting an image file into a Base64 encoded text string. Instead of referencing an image by a file path or URL, Base64 encoding turns the image's binary data into plain ASCII text that can be embedded directly inside HTML, CSS, JSON, XML, or any other text-based format.
The most common form is a Base64 data URI — a single string
that starts with data:image/png;base64, (or image/jpeg,
image/svg+xml, image/webp) followed by the encoded
image data. Browsers and many applications decode this string back into a
normal image on the fly.
This image to base64 converter handles the encoding step instantly in your browser. Upload an image, pick the output format, and copy the result — no command line, no scripts, no external server needed.
Here is how to convert image to base64 using this tool:
Drag and drop a JPG, PNG, SVG, WebP, GIF or BMP file, or click to browse your device.
Choose Raw Base64, Data URI, CSS, HTML, JSON, Markdown or SVG <image>.
Click Copy to place the encoded string on your clipboard, ready to paste.
Check the stats panel to confirm original size, Base64 size and character count.
When you base64 encode an image, the encoder reads the raw
binary bytes of the image file and re-writes them using a 64-character
alphabet (A–Z, a–z, 0–9, +,
/, plus = padding). Every 3 bytes of image data
become 4 characters of Base64 text.
This is why Base64 encoding image output is always about 33% larger than the original file. A 30 KB PNG becomes roughly 40 KB of text. The extra size is the cost of turning binary data into safe, copy-pasteable text.
Base64 image encoding solves a specific problem: embedding an image directly into a text-based file so it travels as one unit. It works well when:
Embed a small icon inside CSS or HTML so it loads with the page, not as a second request.
Many email clients block external images. Inline Base64 keeps the graphic visible.
Ship a self-contained HTML file where images travel with the code, not as separate files.
APIs that accept text only can receive image data as a Base64 string inside JSON.
Quick demos and mockups that should open and render without an image server.
HTML files meant to work without internet access carry their images inline.
This converter handles all common web image formats. Pick the one that matches your source file:
| Format | MIME Type | Data URI Prefix | Best For |
|---|---|---|---|
| PNG | image/png |
data:image/png;base64, |
Icons, logos, transparency, lossless graphics |
| JPG / JPEG | image/jpeg |
data:image/jpeg;base64, |
Photographs and small hero images |
| SVG | image/svg+xml |
data:image/svg+xml;base64, |
Vector logos and scalable icons |
| WebP | image/webp |
data:image/webp;base64, |
Modern compressed web graphics |
| GIF | image/gif |
data:image/gif;base64, |
Simple static or animated graphics |
| BMP | image/bmp |
data:image/bmp;base64, |
Uncompressed bitmap images |
Here is exactly what image as base64 output looks like in each output format this converter supports.
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
.icon {
background-image: url("data:image/png;base64,iVBOR...");
background-size: cover;
}
<img src="data:image/png;base64,iVBOR..." alt="Embedded image">
{
"name": "icon.png",
"type": "image/png",
"data": "iVBORw0KGgoAAAANSUhEUg..."
}

Should you embed an image base64 or keep a normal image URL? Here is how the two compare:
| Feature | Base64 Image | Image URL |
|---|---|---|
| Separate file needed | No — everything is in the text | Yes — separate image file |
| HTTP request | None (loaded with the page) | One per image |
| File size | ~33% larger than original | Original file size |
| Browser caching | Cached with the parent file | Cached independently |
| Editing | Hard to edit by hand | Simple file replacement |
| Best for | Small icons, email, single-file HTML | Regular website images |
Rule of thumb: use image as base64 for small assets under ~10 KB and for self-contained documents. Use normal URLs for everything else — bigger images, photo galleries, hero banners, product images.
Base64 output is larger than the source file. If you need a smaller image, run it through a compressor first, then encode it.
Base64 is reversible by anyone. Do not use it to hide sensitive images. Use real encryption if data must be protected.
A 500 KB photo becomes ~680 KB of text. Large Base64 strings bloat HTML, CSS and JSON and slow down parsing.
A raw Base64 string alone is not an image. To display it, prepend
data:image/png;base64, (or the correct MIME type).
Every Base64 data URI follows the same structure. Understanding each part makes it easier to debug broken images.
Signals that this is a data URL, not a regular file path.
The MIME type of the encoded image. Must match the actual format.
Declares that the following data is Base64 encoded.
The actual Base64 string of the image bytes.
This image to base64 converter is built for developers who need fast, correct output without writing a script every time.
Encode in milliseconds directly in the browser using the FileReader API.
Raw, Data URI, CSS, HTML, JSON, Markdown and SVG <image> — all one click away.
Upload multiple images at once and switch between them from the file strip.
See original size, Base64 size, overhead and character count at a glance.
A clean source image produces cleaner Base64 output. Before encoding, run through this checklist:
Resize the image to the exact dimensions the project needs.
Compress photographs before encoding to keep the string short.
Choose the right format — PNG for icons, JPG for photos, SVG for logos.
Remove unnecessary visual detail that will only bloat the encoded data.
Keep the original file — you may need to re-encode later.
Avoid encoding images larger than ~50 KB when embedding inline.
Use the Image Resizer to adjust dimensions and the Image Compressor to shrink file size before running the Base64 conversion.
| Tool | What It Produces | Use When |
|---|---|---|
| Image to Base64 Converter | Base64 string or data URI | You need to embed an image in text-based code |
| Base64 to Image Decoder | Image file from Base64 | You already have Base64 and need the file back |
| Image to HTML | HTML <img> markup | You want a ready-to-paste HTML snippet |
| Image Converter | Different image format | You want PNG instead of JPG, or WebP instead of PNG |
| Image Compressor | Smaller image file | You want to reduce file size, not encode |
Base64 encoding is one step in a larger image workflow. These tools pair well with the Image to Base64 Converter:
Image to base64 conversion encodes an image file (JPG, PNG, SVG, WebP) into a Base64 text string. That string can be embedded directly in HTML, CSS, JSON, or any other text-based format without needing a separate image file.
Upload your image to this converter, choose the output format (Raw, Data URI, CSS, HTML, JSON, Markdown or SVG), and click Copy. The Base64 string is on your clipboard in one click.
To base64 encode an image means to read the image file's binary bytes and re-write them using 64 text-safe characters. The result is a string that represents the same image data but can be pasted into text files and code.
Base64 image encoding is used for embedding images in HTML, CSS, JSON, email templates, single-file HTML apps, offline documents and API payloads that only accept text.
Yes. Upload multiple images at once and switch between them from the file strip in the preview panel. Each image gets its own Base64 output.
No. Base64 output is about 33% larger than the original binary file. Base64 is an encoding method, not compression. Compress the image first if file size is the concern.
No. Base64 is not encryption. Anyone with the Base64 string can decode it back into the original image. Never use Base64 to hide sensitive images — use proper encryption instead.
Paste the data URI directly into the src attribute:
<img src="data:image/png;base64,...">. The browser
decodes it and displays the image normally.
Use the data URI inside a CSS property:
background-image: url("data:image/png;base64,...").
This is common for small icons and repeating patterns.
Usually not. Large Base64 strings bloat HTML, CSS and JSON, slow down parsing, and prevent the browser from caching the image separately. Keep large images as separate files and reference them by URL.
No. All encoding happens locally in your browser using the FileReader API. Your images never leave your device and are never stored on a server.
Yes. This converter is completely free — no signup, no daily limit, no watermarks, and no hidden charges.
Base64 encode an image for HTML, CSS, JSON, Markdown or email templates in one click. Free, private, browser-based — no uploads and no signup.