Developer

Base64 encode and decode

Text is encoded as UTF-8 before it becomes Base64, so accents and emoji survive a round trip. A file is encoded byte for byte.

Encoding stays in this browser. A file you pick is not uploaded.

How it works

Encode turns the text into UTF-8 bytes and then into standard Base64. Decode reverses that and reads the bytes as UTF-8. A Latin-1 shortcut would break “héllo” and emoji. This page does not use that shortcut.

Choosing a file reads its bytes locally and writes Base64 of those bytes, not a data URL. The file is not uploaded. A bad decode, such as a character that is not in the Base64 alphabet, is reported instead of a garbled string.

Formula

  • Text
    Base64(UTF-8 bytes)
  • hello
    aGVsbG8=

Worked examples

Plain ASCII

“hello” encodes to aGVsbG8=. Decoding that string returns hello.

An accent and an emoji

“héllo 👍” round-trips. The Base64 is longer than the character count because UTF-8 uses more than one byte for those characters.

What gets encoded
InputBytesResult
TextUTF-8Base64 of those bytes
FileThe file’s own bytesBase64, not a data URL
Bad alphabetNoneAn error, not a guess

Common questions

Is the text or the file uploaded?

No. Encoding and decoding run in your browser.

Why did an accent fail in another tool?

Some tools run the text through a Latin-1 encoder. This page uses UTF-8, so é and emoji come back intact.

Does a file download itself?

No. You get the Base64 text. Wrapping it as data:application/octet-stream;base64, is a separate step this page does not add.

Are line breaks allowed in the input?

Decode trims the ends. Line breaks in the middle of the Base64 are not removed. Paste a single block.