← Back to Home

🔤 Base64 Converter

Two-way image ⇄ Base64 conversion with one-tap copy — essential for inline images in front-end code

How the Base64 converter works in three steps

The screenshot below was taken in this tool with a real file and the stated settings — it is not a mock-up.

  1. Upload the imageChoose a PNG or JPG; the encoder fills the text box automatically.
  2. Copy the data URLThe string starts with data:image/png;base64, and can go straight into CSS or HTML.
  3. Reverse it if neededPaste a Base64 string into the same box and press “Base64 → Image” to preview the decoded file.
Base64 Converter result: the generated data URL and the decoded image preview.
Captured: Input: specimen-a-1200x800.png (29 KB PNG). Output: one 39,758-character data URL plus a 1200 × 800 preview.
📁
Click or drag an image here (image → Base64)
Supports PNG / JPG / WebP / GIF / BMP / SVG / AVIF / ICO / HEIC

Base64 output (editable, for reverse conversion)

Image preview

Image preview
Processing…

How to convert Base64

  1. Image to Base64: upload an image and the encoded string is generated automatically
  2. Click "Copy Base64" to put it on your clipboard
  3. Base64 to image: paste the string into the box and click "Base64 → Image"
  4. Once the preview looks right, download the recovered image

How it works

Base64 represents binary data using 64 printable characters (A–Z, a–z, 0–9, +, /). It splits every 3 bytes (24 bits) into four 6-bit groups, each mapping to one character.

Since 6 bits only express 0–63, matching exactly 64 characters, encoded data grows by about 33% (3 bytes become 4 characters). That is why Base64 images are larger than the original file.

On the web it is usually written as a Data URL: data:image/png;base64,xxxx. Browsers recognise this and load the text as an image resource, saving one HTTP request.

Common use cases

It works best for:

Inline images in front-end code

Turn small icons into Base64 inside CSS or HTML to cut request count

API debugging

Recover Base64 images returned by an API to see how they look

Email templates

Some mail clients require images to be embedded as Base64

Config files

Embed images inside JSON or YAML config

Specifications

InputAn image file, or a Base64 string (with or without the data: prefix)
OutputData URL form (data:image/...;base64,)
Supported formatsPNG / JPG / WebP / GIF / BMP / SVG / AVIF / ICO / HEIC
Size changeAbout 1.33× the original file size after encoding
PrivacyConverted locally — never uploaded

FAQ about Base64 conversion

Why is the result so much bigger?

Base64 encoding inherently adds about 33%, an unavoidable overhead of the scheme. Avoid inlining large images — it is meant for small icons of a few KB.

Can I paste Base64 without the data: prefix?

Yes. The tool adds the data:image/png;base64, prefix automatically before parsing. If the original is a JPG but the prefix says PNG, most browsers still identify it correctly.

Do line breaks or spaces matter?

Yes. Paste a continuous string. If the Base64 contains line breaks, remove them first.

Is there a size limit?

Image-to-Base64 is limited by browser memory, usually fine up to tens of MB. But an image over 1 MB becomes very large once encoded, so it is not recommended.