Base64 Image Converter
Convert images to Base64 data URLs for HTML and CSS, or decode a Base64 string back to an image. Images are processed in your browser, not uploaded.
Max 8 MB. The image stays in your browser.
Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)
Free Base64 Image Converter
Convert an image file into a Base64 data URL you can embed directly in HTML, CSS, or JSON — or paste a Base64 string to preview and download it as an image file. It helps developers embed small images in HTML, CSS, JSON fixtures, or tests when a data URI is more convenient than a separate file.
What a Base64 image data URL is
A data URL embeds a file's contents directly inside a string using Base64 encoding, in the form data:image/png;base64,<encoded data>. Browsers treat this exactly like a normal image source, so it can be used anywhere a regular image URL would go — an <img src> attribute, a CSS background-image, or a field in a JSON payload — without needing a separate network request to fetch the file.
How to use this tool
Switch to Image to Base64 and select an image file to get its data URL, ready to copy into your code, along with a live preview so you can confirm it's the right file. Switch to Base64 to Image and paste either a full data URL or a bare Base64 string to render a preview and download it back out as an image file.
Common use cases
- Embedding a small logo or icon directly into an HTML email template, where external images are often blocked
- Inlining a tiny placeholder image into CSS to avoid an extra HTTP request
- Decoding a Base64 image string found in an API response or a browser devtools network payload to see what it actually is
- Bundling a small icon directly into a JSON configuration file or a single-file HTML prototype
Everything happens locally using your browser's built-in file and image APIs — no image you convert here is ever uploaded to a server.
Worked example
Encoding a small PNG icon produces a data URL starting with data:image/png;base64,iVBORw0KGgo..., about 33% larger than the original file since Base64 always expands binary data. Pasting that same string back into Base64 to Image decodes and previews it correctly, since the data URL already declares its own MIME type.
Common mistakes and edge cases
- Pasting a bare Base64 string (no
data:image/...;base64,prefix) always gets labeledimage/pngregardless of the actual format — confirmed by testing. If it's really a JPEG or GIF, the preview will likely still render (browsers sniff actual image bytes), but the reported format text will be wrong. - The reported byte size for a decoded image is an estimate based on the Base64 string's own length and padding, not a byte-for-byte read of the decoded image — treat it as approximate, not exact.