Skip to content
ToutUtils

Developer

Base64 encoder / decoder

Encodes text to Base64 and decodes Base64 back to text, with UTF-8 handling for accents and non-Latin scripts. Type in either box.

Encoding is UTF-8: accents and emojis are handled correctly both ways.

How to use this tool

Type or paste text in the left box to get its Base64 form on the right, or paste Base64 on the right to read the text on the left. The text is first converted to UTF-8 bytes, then every group of three bytes is written as four characters taken from A to Z, a to z, 0 to 9, + and /. When the last group is short, one or two = signs pad the output, so "Hello" (5 bytes) gives SGVsbG8=. The result is about a third longer than the original. When decoding, spaces and line breaks are ignored and missing padding is tolerated, but any other character raises an error. That includes the URL-safe alphabet, which uses - and _ in place of + and /: swap them back first. The tool handles text only. The Base64 of an image or another binary file decodes to unreadable characters.

Concrete examples

  • Hello → SGVsbG8=
  • Man → TWFu (3 bytes, no padding)
  • Été → w4l0w6k=
  • € → 4oKs (one character, three UTF-8 bytes)
  • dXNlcjpwYXNzd29yZA== → user:password (decoding)

Frequently asked questions

Is Base64 a form of encryption?
No. It is a reversible encoding with no key, and anyone who sees the string can decode it: dXNlcjpwYXNzd29yZA== reads user:password. HTTP Basic authentication sends credentials in exactly that form, which is why it must travel over HTTPS. To protect data, encrypt it.
What are the = signs at the end for?
They are padding. Base64 works on groups of three bytes. When the input length is not a multiple of three, the last group is completed and marked with one = (one byte missing) or two (two bytes missing). "Ma" gives TWE=, "M" gives TQ== and "Man" gives TWFu with none.
Why is the Base64 version longer than the original?
Each Base64 character carries 6 bits where a byte carries 8, so three bytes become four characters: a 33% increase, plus padding. A 300-byte text becomes 400 characters. Accented and non-Latin characters add to it, since they already take two to four bytes each in UTF-8.
Why does decoding fail or return strange characters?
An error means the string contains characters outside the Base64 alphabet, often the - and _ of the URL-safe variant used in JWT tokens: replace them with + and /. Strange characters mean the decoded bytes are not UTF-8 text, for example an image, a compressed file or text saved in another encoding.
Is my text sent to a server?
No. Encoding and decoding are done by JavaScript in your browser, and nothing is transmitted or saved. That matters because Base64 strings often hold tokens or credentials. Keep in mind that the encoded result is readable by anyone you send it to.

Related tools