Image ⇆ Base64 Converter

Drag file here, or click to select file

Ad

Tencent Cloud International

Cloud servers and many products on sale, exclusive deals for new users

View Deal
  1. Choose Image → Base64 to generate a Data URI.
  2. Or choose Base64 → Image and paste a Data URI / Base64 string.
  3. Preview the image and copy/download the result.

Help

FAQ

What is a Data URI?Show
A Data URI embeds file content directly in text, usually like data:image/png;base64,....
Why is Base64 larger than the original image?Show
Base64 adds overhead (often ~33%). It’s convenient for embedding, but not always best for performance.
Do I need to paste the full data:image/... prefix?Show
You can paste either a full Data URI or raw Base64. If you paste raw Base64, the tool will treat it as PNG by default.
Why does Base64 → Image show an error?Show
The text may be incomplete, contain whitespace/invalid characters, or not represent an image.

How to convert image and Base64

  1. Choose Image → Base64 to generate a Data URI.
  2. Or choose Base64 → Image and paste a Data URI / Base64 string.
  3. Preview the image and copy/download the result.

Privacy

Full guide

What this tool does

This page supports two workflows:

  • Image → Base64: upload an image and generate a Base64 Data URI.
  • Base64 → Image: paste Base64/Data URI text and preview/download the decoded image.

When Base64 is useful

Base64 can be convenient for:

  • Quickly embedding a tiny image in HTML/CSS for testing
  • Sending an image through a text-only channel (debug logs, JSON payloads)
  • Creating a Data URI for a small icon

For larger images, normal file URLs are usually better.

Examples

Example 1: Data URI prefix

A typical image Data URI looks like:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...

Example 2: Raw Base64 (no prefix)

You may also have raw Base64 like:

iVBORw0KGgoAAAANSUhEUgAA...

If you paste raw Base64, this tool assumes it’s a PNG image.

Tips

  • If you plan to publish on the web, consider converting/compressing the image instead of embedding large Base64 strings.
  • If you need text Base64 (non-image), use the separate text Base64 tool.

URL-safe Base64

Sometimes you may encounter URL-safe Base64 (RFC 4648), where + and / are replaced:

Standard Base64URL-safe Base64
+-
/_
= (padding)often omitted

Why? In URLs, + represents a space and / is a path separator. Using them directly in URL parameters can cause parsing errors.

This tool automatically converts URL-safe Base64 to standard format, so you can paste either form.

Example

Standard Base64:

iVBORw0KGgo+AAA/ANSUhEUg==

URL-safe Base64:

iVBORw0KGgo-AAA_ANSUhEUg

Both will work when pasted into this tool.

Related tools