Base64 to image converter

Content last reviewed:

Paste a Base64 string, click Decode and download the finished image file. The converter recognises eight image formats, and the result is byte for byte identical to the file that was encoded. Its text form runs a third longer than the file itself.

Image preview

Paste Base64 and click Decode to see a preview

to

What is Base64, and what is a data URI?

Base64 writes binary data — a finished image file included — as a string of ordinary text characters. The conversion works three bytes at a time. A byte holds eight bits, while a single Base64 character carries six. Three bytes of a file therefore fit into exactly four characters of text. The alphabet has 64 positions: capital letters A to Z, small letters a to z, digits 0 to 9, plus and slash. When the data runs out before a group of four is complete, an equals sign fills the free places.[1]

A table of the sixty-four Base64 characters numbered from 0 to 63
The whole Base64 alphabet in one picture. The number on the left of each pair is the value of six bits, and the character next to it is how that value is written in text. Plus and slash stand in the last two positions, 62 and 63. Graphic: Arteon, own work.

E-mail attachments are carried this way, and an image reaches the code of a page the same way, with no separate file on the server.[2]

The string on its own says nothing about what it shows. That is the job of a data URI, an address whose shape is set out in RFC 2397 from August 1998. It reads data:[type][;base64],data. For a PNG image the opening looks like this: data:image/png;base64, — and the string itself follows the comma. When the type is left out, the receiving side assumes it was handed plain text.[3]

Browsers now block opening data: addresses in the main window, because phishing pages were being served that way.[4] An image held in such an address is therefore read in the code that contains it, or in a tool that understands the address. Paste the string into the field above and press the Decode button.

How do you turn Base64 into an image?

Paste the string into the Base64 field on the left and press the Decode button. The image appears in the Image preview card, and a Download button underneath saves it to disk as decoded-image. The Clear all button empties the field and the preview together.

The data:image/png;base64, prefix can come along with the string, or stay behind in the code you copied from. Without it the converter reads the first eighteen bytes of data and recognises the format from the file signature. That reading decides the extension of the download: a BMP image is saved as decoded-image.bmp, and a site icon as decoded-image.ico.

A string copied out of an e-mail source is usually broken every 76 characters, and the converter reads it in exactly that shape. The standard that browsers follow when reading Base64 calls for every whitespace character to be removed first, spaces and line endings included.[5] A string pasted across a dozen lines gives the same image as one pasted in a single line.

All of the work happens on your own computer. The string stays in the memory of the open tab, the file is built on your device, and both leave the browser memory once the page is closed.

Above the fields sits a format switcher reading Base64 to JPG. Clicking either of the two formats opens a list, and picking from it takes you to the converter that handles that pair. The opposite direction, writing a finished file as a string of characters, is handled by the image to Base64 converter.

Why is a Base64 string longer than the file?

The text form needs four characters for every three bytes, so the string takes up more room than the data it describes. The arithmetic is short: divide the number of bytes by three, round up, and multiply by four.

Two numbers come out of that formula and they give the scale. A site icon weighs 2,678 bytes and encodes to 3,572 characters. A photo measuring 1920 by 1280 pixels weighs 476,485 bytes, and its text form runs to 635,316 characters. The growth comes to roughly a third each time, around 33 percent.[2] That is also how much a stylesheet or a message template grows once such an image is pasted into it.

Base64 carries data across and changes nothing inside it. What you get after decoding is byte for byte the file that was encoded. We checked this on eight files of different formats, comparing their checksums before encoding and after reading them back.

The length of the string is capped by the browser itself. Chromium and Firefox accept data: addresses up to 512 MB today, and Safari up to 2048 MB. In Firefox that ceiling moved twice. Version 97 raised it from 256 KB to 32 MB. Version 136 took it to the present 512 MB.[4]

Which formats does the converter recognise?

A signature is the first few bytes of a file, the part its format is recognised by, and the MIME type is the name the converter writes into the data URI. The converter reads eighteen such bytes and names the image by them whenever the string carries no data URI prefix. In WebP the WEBP marker sits four bytes after RIFF, and the download is saved as decoded-image with the extension from the last column.
Image formatFile signatureMIME typeExtension
PNG89 50 4E 47image/png.png
JPGFF D8image/jpeg.jpg
WebPRIFF + WEBPimage/webp.webp
GIFGIF87a / GIF89aimage/gif.gif
AVIFftypavifimage/avif.avif
BMPBMimage/bmp.bmp
SVG<svg / <?xmlimage/svg+xml.svg
ICO00 00 01 00image/x-icon.ico
All eight formats were checked on 4 September 2026 in a browser built on the Chromium engine, in both shapes of the string: with the prefix and without it. The preview appears in both, and the downloaded file takes the extension from the last column.

How many characters does an image take in Base64?

Six sizes that really do end up inside page code. All of them were made from a single photo, so the comparison is about file size alone, whatever the picture shows.
ImageSize in pixelsFile size in bytesCharacters in the Base64 string
Site icon in PNG32 × 322,6783,572
Page graphic in WebP800 × 600104,128138,840
Blog post photo in JPG1200 × 630157,419209,892
Banner photo in JPG1920 × 1280476,485635,316
Logo with a transparent background in PNG512 × 512577,420769,896
Camera photo in JPG3840 × 25601,405,5121,874,016
The character counts come from the formula: bytes divided by three, rounded up and multiplied by four.[1] The data URI prefix adds between 22 characters for image/png and 26 characters for image/svg+xml.

How do the two Base64 alphabets differ?

One document describes two sets of characters. The first goes into data URIs and into e-mail, the second into places where plus and slash carry a meaning of their own.
Part of the encodingStandard alphabetURL and filename safe alphabet
Character at index 62plushyphen
Character at index 63slashunderscore
Padding characterequals signequals sign, usually left out in tokens
Where you meet itdata URIs, page code, e-mail attachmentsURL parameters, JWT tokens, file names
What to do with such a stringpaste it into the field and press Decodeswap each hyphen for a plus and each underscore for a slash, then press Decode
Both sets of characters are defined in RFC 4648: the standard one in section 4, the address-safe one in section 5.[1]

Where do you find a Base64 string to paste?

Four places where an image is stored as text, along with the part to select.

  1. Page source holds the string in the src attribute

    Open the page and press Ctrl+U, or Cmd+Option+U on a Mac. In the source window look for the fragment data:image. Select it together with the whole string that follows, up to the quotation mark closing the src attribute.
  2. A stylesheet keeps it in the background-image property

    A background image is often written as background-image: url("data:image/png;base64,…"). Paste the address alone into the field, meaning the part from the word data to the closing quotation mark, leaving out the url( at the front and the bracket at the end.
  3. An e-mail carries it inside its source

    Viewing the source of a message shows the images embedded in the body. They come after a Content-Transfer-Encoding: base64 header, and the string itself starts after a blank line and is broken every 76 characters. Copy it whole, line breaks and all.
  4. An API response hands it over as a field value

    JSON carries text and nothing else, so services that return an image return it in Base64, as the value of a single field. Copy the contents of that field without the quotation marks around it.

What can you do with the image once it is decoded?

The downloaded file is an ordinary image and goes into every other tool.

  1. The image gets new dimensions

    A file pulled out of code has the dimensions somebody chose for that page. New ones are set in the image editor, where you crop the frame and give it a target width.
  2. The file is heading for a website

    A PNG pulled out of a stylesheet usually weighs more than a page today needs. A lighter file that keeps its transparency comes from the PNG to WebP converter.
  3. The decoded file turned out to be a site icon

    An .ico extension means the decoded file is the icon of a website. The remaining icon sizes, together with the tags ready to paste into your code, come from the favicon generator.
  4. The reverse direction

    Your own image becomes a string ready to paste into code in the image to Base64 converter. It is the same pair of tools, turned around.

Convert other files to JPG

Sources

  1. RFC 4648: The Base16, Base32, and Base64 Data EncodingsIETF
  2. Base64Wikipedia
  3. RFC 2397: The "data" URL schemeIETF
  4. Data URLsMDN Web Docs
  5. Infra Standard, forgiving base64 decodeWHATWG

The file sizes in the tables were measured by running finished images through this converter in a browser, and we report them the way the tool counts them. What the page says about either format rests on the sources listed above.

Content last reviewed: · written and checked by the Arteon team

Common questions about turning Base64 into an image

What should I do when the string has no data:image/… prefix?

Paste the string on its own and press Decode. The converter reads the first eighteen bytes of data, recognises the format from them and adds the missing prefix itself before drawing the preview.

Does the pasted string reach a server?

All of the work happens in your browser. The string stays in the memory of the tab from the moment you paste it until you close the page, and the file you download is built on your own device.

Does decoding change the quality of the image?

The decoded file is byte for byte identical to the file that was encoded. Base64 carries the data in another shape and removes nothing from it, so the quality depends on the original alone.

My string has hyphens and underscores where plus and slash should be. What now?

That is the alphabet meant for URLs and file names, defined in section 5 of RFC 4648. Swap every hyphen for a plus and every underscore for a slash in your editor, then paste the result into the field and press Decode.

How long a string will the browser accept?

Chromium and Firefox handle data: addresses up to 512 MB today, and Safari up to 2048 MB. A camera photo encodes to under two million characters, which is less than 2 MB of text, so it fits inside those limits with a great deal of room to spare.

Why does a string pasted into the address bar show no image?

Browsers block opening data: addresses in the main window, because phishing pages were sent around that way. An image held in such an address is read in the code that contains it, or in this converter.

Will the converter open an address written with percent signs, without Base64?

Yes. An address in the form data:image/svg+xml,%3Csvg… is pasted like any other, and the downloaded file takes the .svg extension. Build tools write vector graphics in that shape when they place them straight into code.

How do I turn my own image into a Base64 string?

The reverse direction is handled by the image to Base64 converter. You upload a file there and the tool hands back a finished data URI to paste into your code.

Arteon free tool screenshot: Base64 to image converter

Help us improve our tools

Have an idea, found a bug, or want to suggest a feature? Drop us a message – we respond within 24 hours.

Explore other useful tools

JPG to WebP

JPG to WebP

Convert JPG photos to lightweight WebP. Cut image weight by up to 35%.

Online image editor

Online image editor

Resize, crop and convert your image. Ready-made formats for social media, circular avatars, export to JPG/PNG/WebP.

Meta title & description checker

Meta title & description checker

Check title and description length in pixels. Live Google preview and optimization tips.

PNG to JPG

PNG to JPG

Convert PNG files to JPG in your browser. No file limits, no signup, no server uploads.

Favicon generator

Favicon generator

Create a complete favicon.ico set for your website from one image. All required sizes, no login.

Color palette generator

Color palette generator

Generate 9 palettes from one color: monochromatic, complementary, triadic and more. HEX codes.

WebP to JPG

WebP to JPG

Convert WebP files to universally compatible JPG. Works in every app and platform.

Color contrast checker

Color contrast checker

Check text and background contrast per WCAG 2.1 AA and AAA. Automatic color correction.

Free QR code generator

Free QR code generator

Create a QR code for a website, vCard business card or print. Export PNG and SVG, no registration.

Word & character counter

Word & character counter

Count words, characters, sentences and reading time. Check readability with the Flesch-Kincaid score.