About this image to Base64 converter
Convert images (PNG, JPG, GIF, SVG, WebP, BMP, ICO) into Base64 data URLs that can be embedded directly in HTML, CSS, JSON, Markdown or email without a separate file request. The output is a string of the form data:image/png;base64,iVBORw0KGgo... which browsers render exactly like an image file. Typical uses are inlining small icons and logos in a single-file HTML page, email signatures, CSS background images, favicons, JSON API payloads and test fixtures.
How to use the Image to Base64
- Drop an image or choose a file (nothing is uploaded; it is read locally in your browser).
- Pick the output format: raw Base64, data URL, HTML img tag or CSS background-image.
- Copy the snippet into your code.
Example
logo.png (2 KB) → <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." alt="logo">
icon.svg → background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0i...");Frequently asked questions
When should I inline images as Base64?
For small icons and images under a few kilobytes, single-file HTML documents, email templates and places where you cannot host a separate file. Larger images are better served as separate cached files because Base64 adds about 33 % to the size and cannot be cached independently.
How do I use a Base64 image in HTML?
Put the data URL in the src attribute: <img src="data:image/png;base64,...." alt="">. Choose the HTML img tag output and the tag is generated for you.
How do I use a Base64 image in CSS?
Use it as a background: .logo { background-image: url("data:image/png;base64,...."); }. The CSS output option produces the complete rule.
Does Base64 make the image bigger?
Yes, by roughly 33 % (every 3 bytes become 4 characters). Gzip or Brotli compression on your server recovers most of that, but the image can no longer be cached separately from the page.
Can I convert SVG to Base64?
Yes. SVG files become data:image/svg+xml;base64,... which works in img tags and CSS. For SVG you can also URL-encode the markup instead of Base64, which is slightly smaller.
How do I convert Base64 back to an image?
Paste the data URL into a browser address bar to view it, or decode the Base64 part with the Base64 tool and save the bytes with the matching extension. In C#, Convert.FromBase64String gives you the byte array.
Is there a file size limit?
No hard limit. The conversion runs in your browser, so very large files simply take a moment and produce a very long string. For anything over a few hundred kilobytes, consider a hosted file instead.
Is my data safe?
Yes. The tool runs entirely in your browser using WebAssembly. Nothing you type or upload is sent to a server, logged or stored.
Is it free?
Yes, completely free with no sign-up, no limits and no watermarks. It also works offline once the page has loaded.