Base64 Encoder / Decoder

Encode text or decode Base64 data, for instance in email attachments and data URLs, whenever binary data must be transmitted as text. GDPR-compliant.

The result will appear here …

How to use this tool (video)

This video is hosted on YouTube. When you play it, data may be sent to Google.

Base64 Encoder and Decoder: Convert Data to Text

Base64 turns binary data into printable text. It appears in data URLs, email attachments, JSON payloads, and API requests. This tool encodes text to Base64 and decodes Base64 back into readable text directly in your browser.

How Base64 works

Base64 uses 64 characters to represent binary bytes: A–Z, a–z, 0–9, plus + and /. The = at the end is padding. Every three bytes become four Base64 characters, so the encoded result is about 33 percent larger than the original. Because the alphabet contains only printable, non-control characters, Base64 data travels safely through emails, URLs and JSON.

Examples:

  • ManTWFu (the classic example: 3 bytes, 24 bits, split into four 6-bit groups)
  • aYQ== (one byte plus two padding characters)
  • Hello WorldSGVsbG8gV29ybGQ=

Step by step: where TWFu comes from

The letters M, a and n have the ASCII values 77, 97 and 110, that is the bytes 01001101 01100001 01101110. These 24 bits are split from the left into four groups of six bits: 010011, 010110, 000101, 101110. As decimals those are 19, 22, 5 and 46. In the Base64 alphabet these map to T, W, F and u, giving TWFu.

Why the output is about 33 percent larger

The reason lies in the mathematics of the method. A byte holds 8 bits, but a Base64 character carries only log2(64) = 6 bits. So three bytes (24 bits) become four characters (4 × 6 = 24 bits). Every three-byte block adds four characters, a ratio of 4 to 3, or about 33 percent more than the original. For leftover lengths the output is padded with =, for example a becomes YQ==, so the length stays divisible by four.

Common decoding pitfalls

Even though Base64 looks simple, there are traps. If the input contains characters outside the alphabet (for example a stray space or an umlaut in the wrong context), or the length is not properly divisible by four without correct padding, decoding usually stops. The browser reports an invalid input, and this tool catches that and shows a clear error message. Always copy strings completely and without hidden line breaks.

Where Base64 is used

  • Email attachments (MIME) emails can only transport text, so images, PDFs and other files are embedded as Base64
  • Data URLs in the web embed images directly in HTML or CSS
  • API authentication basic auth encodes username and password as Base64 (not encrypted, so use HTTPS only)
  • JSON Web Tokens (JWT) the three parts are base64url-encoded JSON objects
  • JSON payloads pack binary data into a string

Encoding vs. decoding

  • Encoding turns plain text into Base64. For example Hallo Welt becomes SGFsbG8gV2VsdA==.
  • Decoding reverses it. From SGFsbG8gV2VsdA== you get Hallo Welt back.

Base64URL and the JWT connection

Standard Base64 includes the characters + and /, which are awkward in URLs and file names. The Base64URL variant replaces them with - and _ and usually omits the = padding. This form is used in the three parts of a JSON Web Token (JWT), which you can inspect with our JWT decoder.

Encoding is not encryption

Base64 is an encoding format, not a security method. Anyone can decode a Base64 string in a click. Use real encryption such as AES or HTTPS when data must remain confidential.

What about umlauts and emoji?

The alphabet only covers Latin basic characters. Non-Latin input such as umlauts, emoji or other Unicode characters must first be encoded to UTF-8 bytes, which is exactly what the browser's standard functions do for plain text. The resulting Base64 then represents those UTF-8 bytes, which is why the same text can look different depending on the underlying encoding. If a string is not Latin-compatible, encoding can fail, and this tool shows that as a clear error.

Frequently asked questions

What is Base64 anyway?

Base64 is a method for representing binary data as text. It uses 64 printable characters, hence the name. Three bytes become four Base64 characters, so the encoded data is about 33 percent larger than the original.

How do I encode text to Base64?

Enter your text in the input field and choose Encode. The tool converts the text into its Base64 representation, which you can copy directly.

What is the difference between encoding and decoding?

Encoding turns plain text into Base64, decoding reverses that. For example the text Hallo becomes SGFsbG8=, and from that Base64 string you get Hallo back again.

Is Base64 the same as encryption?

No. Base64 is not encryption, it is only an encoding so data can be transported as text. Anyone can decode a Base64 string in a few clicks. For confidential data you need real encryption such as AES or HTTPS.

Where is Base64 used in everyday life?

Base64 appears in email attachments, in data URLs for images, in basic authentication and in the parts of a JSON Web Token. In all these cases binary data is transferred as text.

Are my data uploaded anywhere?

No. Encoding and decoding run entirely in your browser. Your content is not transmitted to our server and is not stored.

Are my data stored?

No. Encoding and decoding run completely in your browser. Your text is not transmitted to our server and is not stored.