araç köşesi

What is Base64, and why is that wall of random text there?

How to recognise a Base64 string, turn it back into a file, or send one

You opened the source of an email, or copied something from a web page, and got a block of letters and digits that runs on for lines: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg…". Or a developer asked you to "send the logo as base64" and you are not sure what they mean. Both situations come down to the same thing, and neither is anything to worry about.

In short, Base64 is a way of rewriting a file using only letters, digits and a couple of symbols. In other words, that long string is usually the picture or document itself, just poured out into plain characters. Below you will learn how to recognise it, why it hides nothing, why it makes files bigger, and how to turn what you have back into a file.

Where you are most likely to run into it

Nobody reads Base64 on purpose; you see it when you look behind something. Computers use it to push pictures and documents through channels that were built to carry text only. Email is the oldest example: early mail systems could only move plain text, so attachments are still turned into text for the journey. You never notice, because your mail program quietly turns them back before showing them to you.

  • In Gmail, open a message, open the three-dot menu in the message's top right corner, then pick "Show original"; attachments appear there as long blocks of this text
  • Press Ctrl+U in Chrome (Command+Option+U on a Mac) to view the page source; small icons and logos often show up as lines starting with "data:image/…;base64,"
  • Right-click a picture and choose "Copy image address"; on some sites you get this long string instead of a web address
  • Inside an app's settings file or a code sample a developer sent you, as one long line between quotation marks

Base64 is not encryption

Because it looks unreadable, people often assume Base64 protects something. It does not. The rules are public and decoding needs no key, password or permission. The word "Hello" becomes "SGVsbG8=" in Base64, and anyone who gets hold of that string can turn it back into "Hello" in a second with a free tool.

Two practical consequences follow. First, if someone sends you a password or an ID number and says it is "hidden with Base64", treat it as if it had been sent in plain text. Second, converting your own personal details to Base64 before posting them somewhere does not protect them. Anything that must stay private needs a password-protected file or an encrypted connection.

All Base64 does is change the shape of the data: not a single byte is lost, altered or hidden. A photo that is converted to Base64 and back is identical to the original, with no loss of quality.

Three bytes in, four characters out

Every file on a computer is a long row of small numbers called bytes. Base64 takes them three at a time. Three bytes side by side make 24 ones and zeros, and Base64 cuts that row into four pieces of six digits each. Six binary digits can express 64 different values, so each piece maps to one character from a 64-character list made of capital letters, small letters, digits and two symbols, + and /.

The diagram below follows the three bytes of the word "Cat" on their way to becoming "Q2F0". Every file goes through the same machine: a photo, a PDF or a song makes no difference. When the end of a file does not divide evenly by three, the gap is filled with one or two = signs, which is why some Base64 strings end that way.

The three bytes of the word Cat written as 24 bits, cut into four groups of six bits and turned into the characters Q2F0
Every three bytes become four characters, which is why the growth is always the same.

How much bigger will your file get?

Since three bytes turn into four characters, anything converted to Base64 grows by about a third, or 33 percent. This is not an estimate; it follows directly from the method. The file type, its content and the program used make no difference.

Email attachments grow a little more. Mail standards ask for lines of at most 76 characters, so a line break is added after every 76 characters of encoded text, and the total growth climbs to around 37 percent. That explains a common complaint: "my file was under the limit, but the email bounced". Your provider's attachment limit may apply to the encoded size. Check the exact figure on your email provider's help page and leave that margin for files close to the limit.

Original fileAs Base64As an email attachment (with line breaks)
30 KB logo40 KBabout 41 KB
1 MB photoabout 1.33 MBabout 1.37 MB
3 MB document4 MBabout 4.1 MB
10 MB slide deckabout 13.3 MBabout 13.7 MB

Reading the start of the string

A line beginning with "data:" has four parts, and the first three read almost like plain English. "data:" says this is not a web address but the data itself. The part after it, such as "image/png", declares the type of content: image means a picture, application/pdf means a PDF document. ";base64," names the encoding. Everything after the comma is the file.

A bare Base64 string with no "data:" in front can be identified too, because every file type starts with fixed bytes, and those bytes always turn into the same letters in Base64. Compare the first few characters with the table below and you will usually know what you have without opening it.

If the string starts withIt most likely holds
iVBORw0KGgoa PNG image
/9j/a JPG photo
R0lGODa GIF image
UklGRa WEBP image (occasionally an audio or video file)
PHN2Zy or PD94bWwan SVG drawing or another XML file
JVBERi0a PDF document
UEsDBa ZIP archive; Word and Excel files start this way too

Turning the string back into a file

If it is a picture (one of the first five rows of the table), paste the whole line into the Base64 to Image tool. You do not need to strip the "data:" part or the surrounding quotation marks. The tool previews the image straight away, and the Download button saves it with the right extension, which the tool reads from the opening bytes of the picture itself, not from the label in front.

If it is text, for example a short string from an app's settings, use the Base64 text tool with the direction set to "Decode — Base64 to text". When the result is not readable text, the tool says so plainly, which means what you have is really a file.

An honest limit: the tools on this site do not rebuild PDF, ZIP or Word files from Base64. If the table points to a PDF or an archive, the simplest route is to ask the sender for the file as a normal attachment. And take care when copying: a single missing character is enough to make the file unreadable, so select everything, including any = signs at the end.

When a developer asks you to "send it as base64"

This request is usually about a small file that will be built into a website, an app or an email template. Before sending anything, ask one question: "Do you want a data URI or plain Base64?" The first starts with the "data:image/png;base64," prefix and can be pasted straight into a page; the second is just the encoded part with no prefix.

For a picture, use the Image to Base64 tool: pick the image, choose the format you were asked for under "Output shape" and press Encode to Base64. You get one .txt file per image. If they need a PDF, a font or any other file, the Convert Any File to Base64 tool does the same for every file type, and offers a 76-character line wrap for email use.

Send the downloaded .txt file as an attachment rather than pasting the long text into a chat app. Long messages can be split or shortened in chat windows, and if the other side gets an incomplete piece, the file will not open at all. With these tools your file never leaves your computer; the conversion happens inside the browser.

Frequently asked questions

Can Base64 be decoded?

Yes, always, by anyone. No key or password is involved and the rules are public. That is why information in Base64 should never be treated as secret.

Does converting a picture to Base64 reduce its quality?

No. Base64 copies the file's bytes into characters exactly as they are, and decoding produces a file identical to the original. The only change is that the text version takes up about a third more space.

Is the long text in my email source the attachment itself?

Very likely, yes. Attachments are converted to Base64 for sending and your mail program converts them back. The block you see in the source is the text carrying the attachment; in the normal view it simply appears as a file.

Can a Base64 string contain a virus?

Base64 is only a wrapping. Whatever file was put in comes out again when decoded. If you decode a string from someone you do not know and open the result, use the same caution you would with any email attachment.

Does Base64 make a file smaller?

Quite the opposite: it makes it bigger. If size matters, shrink the file itself first, for example with the Image Compressor for a picture, and convert to Base64 afterwards.

Last updated: October 12, 2026

Tools in this guide