B64
Runs in your browserNothing is uploadedImages

Image to Base64

Encode an image as a base64 data URL, ready to paste as an HTML img tag, a CSS background or Markdown.

Loading tool…
Short answer

Image to Base64 encodes a picture as text you can paste into code: a data URL, the bare base64, an HTML img tag, a CSS background rule or Markdown. It detects the real file type from the bytes and runs in your browser.

What is a base64 data URL?

Base64

A way of writing binary data with 64 plain text characters. The text is about a third larger than the file it encodes.

Data URL

A link that carries the file inside itself, such as data:image/png;base64,... It works wherever an image address is accepted, with no separate file to host.

Why use Image to Base64?

  • Fewer requests for small icons. Inline tiny images in HTML or CSS so the page does not fetch them separately.
  • Images in emails and single files. Embed a logo in a self-contained HTML file, a test fixture or a JSON payload.
  • Nothing leaves your device. The encoding happens in this tab; the image is not uploaded anywhere.

How to use Image to Base64, step by step

Image to Base64 in PrintxPDF with a file loaded, options on the right and the run button below
Image to Base64 with a file loaded: the steps below follow this screen.
  1. Add an image to Image to Base64. Drop a PNG, JPG, GIF, WebP, SVG or other image file.
  2. Choose the output form. Pick a data URL, bare base64, an img tag, a CSS rule or Markdown. The text updates straight away.
  3. Copy or download. Press Copy, or save it as a text file.

Frequently asked questions

Should I inline every image?

No. Base64 is larger than the file and cannot be cached separately, so it suits small icons only. Keep photos as normal files.

Is there a size limit?

Files up to 15 MB are accepted. Beyond that the text becomes too large to paste anywhere useful.

How do I turn base64 back into a picture?

Paste it into Base64 to Image.

Looking for the long version? The guides cover each of these jobs in depth.