Image to Base64

Turn an image into a Base64 data URI, HTML img tag, CSS background or Markdown snippet you can paste into code. No upload.

Runs in your browserNo sign-upWorks offline
↑Drop files here

or

JPG, PNG, WebP, GIF · Files stay on your device

image-1.jpg412 KB → 96 KB
image-2.jpg1.1 MB → 240 KB
image-3.jpg860 KB → 188 KB
Sample files shown

What the Image to Base64 does

Image to Base64 converts a picture into text you can paste straight into code. Choose a data URI, the Base64 text alone, a ready-made HTML <img> tag with width and height, a CSS background rule, or a Markdown image. The tool shows how large the encoded text is and warns when an image is too big to inline sensibly.

How to use it

  1. Drop an image onto the box. JPG, PNG, WebP, GIF, SVG and AVIF work.
  2. Pick the output: Data URI, Base64 only, HTML, CSS or Markdown.
  3. Copy the text, or download it as a text file.
  4. Paste it into your HTML, stylesheet, email template or document.

Example

An email signature needs a small 2 KB logo that shows even when the email app blocks outside images. Choose HTML and copy the result: an <img> tag whose source starts with data:image/png;base64,. Paste it into the signature and the logo travels inside the email itself.

When to inline an image

Inlining saves a separate download, which helps for tiny icons, email signatures and single-file pages. But Base64 text is about a third bigger than the image file, it cannot be cached on its own, and it makes HTML and CSS files heavier. As a rule, inline images smaller than about 10 KB and keep larger ones as separate files.

The file is encoded exactly as it is, with no recompression, so the quality is unchanged.

Questions people ask

Is my image uploaded?

No. The image is opened and processed in your browser and never uploaded. You can switch off your internet after the page loads and the tool keeps working.

How do I turn Base64 back into an image?

Paste the data URI into your browser’s address bar and save the image that opens.

Why is the text so long?

Every 3 bytes of the image become 4 characters of text.

Do SVG images work?

Yes. For SVG, plain URL encoding is often shorter; the SVG Editor can help clean the file first.

Related tools