Image to Base64

Convert a JPG, PNG, WebP, GIF, BMP, or AVIF image into a Base64 string or Data URI.

Drop an image here, paste, or click to upload

JPG, PNG, WebP, GIF, BMP, AVIF — up to 30MB

Related Tools

Learn more about the Image to Base64

Convert an Image to Base64 Online, Free

This tool reads an image with the browser's built-in FileReader API and encodes it as a Base64 string — nothing is uploaded to a server. Upload, drag in, or paste an image, then copy the result as a raw Base64 payload or a ready-to-use Data URI.

A Data URI includes the data:image/png;base64, prefix so it can be dropped straight into an <img src> attribute or a CSS background-image. The raw Base64 option strips that prefix, which is usually what you want when embedding the string in a JSON payload, database column, or config file.

Why Convert an Image to Base64?

Inline a Small Image in CSS or HTML

Embed an icon or small graphic directly in a stylesheet or `<img src>` as a Data URI, avoiding a separate file request.

Send an Image Through a JSON API

Some APIs only accept text fields — Base64-encode an image to pass it as a JSON string value.

Store an Image in a Database Column

Base64 text can be stored in a plain text or varchar column when a binary/blob column isn't an option.

Email Templates & Embedded Assets

Some email clients and offline HTML exports render inline Base64 images more reliably than linked files.

Features

Base64 or Data URI

Get just the raw Base64 payload, or a ready-to-use "data:image/...;base64," URI.

Upload, Drag, or Paste

Choose a file, drag it in, or paste an image straight from your clipboard.

Any Image Format In

JPG, PNG, WebP, GIF, BMP, and AVIF are all supported as source files.

No Server Upload

Encoding happens with the browser's built-in FileReader API — the image is never sent anywhere.

One-Click Copy

Copy the encoded string straight to your clipboard, ready to paste into code.

Download as .txt

Save the Base64 string as a text file if you need it outside the clipboard.

How to use

Paste your input in the left editor. The output appears automatically on the right. Use the toolbar buttons to copy, download, or transform the result.

  1. Paste or type your content in the input editor on the left.
  2. The formatted output is generated automatically.
  3. Use Copy, Download, or other actions from the output toolbar.
  4. Click the expand icon to view the output in fullscreen.
FAQ

Is this image to Base64 converter free?

Yes, it is completely free to use with no limits, signup, or account required.

Is my image uploaded to a server?

No. The image is read and encoded entirely in your browser using the FileReader API. It is never uploaded or sent to a server.

What's the difference between "Base64" and "Data URI" output?

Data URI includes the "data:image/png;base64," prefix so it can be used directly as an <img src> or CSS background-image. Base64 is just the raw encoded payload, which is usually what you want for a JSON field, database column, or config file.

Which image formats can I convert?

Upload a JPG, PNG, WebP, GIF, BMP, or AVIF file. The output is always a Base64-encoded string of that same file.

Does Base64 encoding make the file bigger?

Yes — Base64 encoding increases the size by roughly 33% compared to the original binary file, since it represents binary data using only text-safe characters.

Can I paste an image instead of uploading a file?

Yes. Copy an image to your clipboard and paste it directly onto the page, or drag and drop a file, or click Choose Image to browse. Files up to 30MB are supported.