How to convert an image to Base64
- Drop an image on the box or tap “Choose image”.
- Copy the format you need: the full data URI, the Base64 text alone, or a ready-made HTML, CSS or Markdown snippet.
- Paste it into your code. The image now travels inside the page or file instead of being loaded separately.
What a data URI looks like
A data URI has three parts: data:, the file type (for example image/png) followed by ;base64, and after a comma the encoded image. Anywhere a browser accepts an image address — an <img src>, a CSS url() or a Markdown image — it accepts a data URI too. The format is defined in RFC 2397, and Base64 itself in RFC 4648.
When Base64 helps, and when it hurts
- Good for: small icons and logos, self-contained HTML files or reports, images inside JSON or config files, and tests.
- Not good for: photos and large graphics. The text is about 33% larger than the file, it can’t be cached on its own, and it makes HTML and CSS slower to download and parse.
- Email: support varies between email programs (older Outlook for Windows doesn’t show them), so an image link or attachment is safer.
For anything bigger than a few kilobytes, an ordinary image URL is usually better. Upload the image to PictureToLink to get a direct link, or read Base64 images vs URLs for a fuller comparison.
Make it small first
Because every byte grows by a third, shrink the image before encoding: resize it to the size it will be shown at, and compress it. For simple icons, an SVG file is often smaller still.
Decoding Base64
Got a long string starting with data:image or iVBOR (a PNG) or /9j/ (a JPG)? Switch to “Base64 → Image” and paste it. The tool also accepts URL-safe Base64 and ignores line breaks. For safety, SVG data is not previewed, because SVG files can contain scripts.
