Loading tool...

How to Convert Base64 to UTF-8

If a decoded string shows é where an é should be, or a row of odd symbols where an emoji was, the bytes were read the wrong way. Paste the Base64 here and it is read as UTF-8, the encoding nearly every modern system uses for text.

Step 1

Paste the Base64 string

Paste the string into the input panel. Line-wrapped Base64, URL-safe Base64 with - and _, a data URI and a value still in its quotes all work. The Sample button loads a short line with Chinese characters and an emoji.

•
From an API or JWT: URL-safe Base64 without = padding is fine; paste one part of a token at a time, not the dots.
•
From an email or a terminal: Base64 split over many lines, as base64 or a MIME message writes it, is read as one string.
•
Try sample: Click "Sample" to load SGVsbG8g5LiW55WMLSDwn4yQ, which holds 3-byte and 4-byte characters.
Step 2

Read the UTF-8 text

A moment after you paste, the decoded text appears on the right. Accents, other alphabets, emoji, line endings and numbers come out exactly as they were encoded. If some bytes are not valid UTF-8, a note says where the first one is.

•
Multi-byte characters: Sm9zw6k= decodes to José, and 5pel5pys to 日本.
•
Invalid bytes: a byte that can't be UTF-8 shows as �, with a note giving its position and value, for example 0xC3.
•
Not text at all: if the bytes are an image, a PDF or an archive, you get a message instead of junk. Base64 to File can save those.
Step 3

Copy or download it

Click Copy to put the text on your clipboard or Download to save it as utf8-text.txt, a UTF-8 file with the same bytes as the original, including a BOM if it had one.

•
Same bytes back: for valid UTF-8 the downloaded file matches the original byte for byte, Windows line endings included.
•
Going the other way: UTF-8 to Base64 encodes text back into a single line.

What is Base64 to UTF-8 Decoding?

Base64 turns bytes into letters, digits, + and /. It knows nothing about characters. When text is Base64-encoded, it is first written as bytes in some character encoding, and that encoding is nearly always UTF-8.

Decoding therefore has two steps: Base64 back to bytes, then bytes back to characters. This page does both and does the second one as UTF-8, checking every byte along the way. It shows the text exactly as decoded and does not trim, reformat or change any of it.

Frequently Asked Questions

What does UTF-8 have to do with Base64?

Base64 only stores bytes. Before text can be Base64-encoded it has to be turned into bytes, and today that is almost always done with UTF-8. In UTF-8 the letters of plain English take one byte each, an é takes two, Chinese and Japanese characters take three, and an emoji takes four. Decoding Base64 gives you those bytes back; reading them as UTF-8 is the step that turns them into the original characters again.

Why did other decoders show José instead of José?

Many quick decoders call the browser's atob() and show its result directly. atob() returns one character per byte, which is how Latin-1 works, not UTF-8. So the two bytes of é (C3 A9) show up as two separate characters, Ã and ©, and an emoji turns into four characters of junk. This page reads the bytes as UTF-8 instead, so Sm9zw6k= decodes to José and emoji, CJK and Arabic text come out as written.

What happens when the bytes are not valid UTF-8?

Some byte patterns can never appear in UTF-8, for example a lone C3 with nothing after it, or the byte FF. Each bad sequence is shown as the replacement character � (U+FFFD), the same thing a browser does, and a note above the output says how many there are and at which byte the first one is. This usually means the text was saved as Windows-1252 (Latin-1) or another older encoding, or the Base64 was cut or changed somewhere. Copy and Download then contain the � characters, so if you need the exact original bytes, use Base64 to File.

What is the BOM and does this page keep it?

A byte-order mark is the three bytes EF BB BF at the very start of a file. Windows tools such as Notepad and Excel often add it to UTF-8 files. It is invisible, but some programs care about it, so this page keeps it: a note tells you it is there, and Copy and Download include it, so the download has exactly the same bytes as the original.

Is Base64 a way to protect text?

No. Base64 is an encoding, not encryption. Anyone who has the string can decode it in a second, exactly as this page does. If a password, token or private message is only Base64-encoded, treat it as readable by anyone who sees it.

Is the text I decode sent anywhere?

No. Decoding runs in JavaScript in your browser and the download is built on your own machine. Nothing is uploaded and nothing is kept, so a reload starts with an empty editor.

Related pages: UTF-8 to Base64 · Base64 to File · Base64 to String