๐Ÿ” Base64 Encode/Decode

Input
Output

Encode text to Base64, or decode a Base64 string back to plain text. Useful for things like Basic Auth headers, lightly obfuscating data, or embedding a value in a config file.

How to use

  1. Choose "Encode" or "Decode" mode.
  2. Paste your text or Base64 string into the input box.
  3. Click the run button to see the result.
  4. Click "Copy" to copy the result to your clipboard.

How the calculation works

Base64 encodes binary data using 64 characters: letters, digits, "+" and "/". It is specified in RFC 4648. Every three bytes (24 bits) are split into four six-bit groups, each mapped to one character. When the input does not fill a final group of three bytes, the output is padded with "=" to a multiple of four characters. Text must be turned into bytes before it can be Base64-encoded. This tool converts characters to bytes as UTF-8, and when decoding reads the bytes back as UTF-8, so Japanese and other multi-byte text works. Most Japanese kana and kanji take three bytes each in UTF-8. Base64 is not encryption. Anyone can reverse it by the same steps, so it offers no protection for passwords or other secrets.

Worked example

Encoding "Hi" "H" and "i" are two bytes, one short of three. The result is "SGk=", with "=" filling the gap. Encoding "ใ“ใ‚“ใซใกใฏ" In UTF-8, 5 characters ร— 3 bytes = 15 bytes, and 15 รท 3 ร— 4 = 20 characters. Result: 44GT44KT44Gr44Gh44Gv

Things to be aware of

  • Base64 is not encryption. Do not use it to protect sensitive data.
  • Encoded data is about 4/3 the original length (about 33% longer).
  • In URLs, "+" and "/" cause problems; use the Base64URL variant with "-" and "_" instead.
  • If decoding fails, check for stray spaces, line breaks or characters outside the Base64 alphabet.

FAQ

Is Base64 encryption?

No โ€” Base64 is encoding, not encryption. Anyone can decode it easily, so don't use it for anything that needs to stay secret.

Can it handle multi-byte characters like Japanese?

Yes โ€” text is treated as UTF-8, so you can encode and decode any text including Japanese.

Can I build a Basic Auth header with this?

Yes โ€” encode text in "username:password" format to get the value used in an Authorization: Basic header.

Why does decoding fail?

It fails if the input isn't valid Base64 โ€” check for stray whitespace or line breaks in what you pasted.

Is my input text sent to a server?

No, encoding and decoding happen entirely in your browser and nothing is sent externally.