Skip to content
CalcSpectrum

Base64 Encode/Decode Calculator

Encode text to Base64 or decode Base64 back to text, with correct UTF-8 handling for Unicode and emoji.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

\text{Base64} = \text{encode}_{64}(\text{UTF-8 bytes of text})

Base64 is an encoding scheme that represents arbitrary bytes as printable ASCII text, using 64 characters (A-Z, a-z, 0-9, +, /) plus '=' padding. It is NOT encryption: anyone can decode Base64 back to the original data with no key, so it must never be used to protect secrets. This calculator first converts input text to UTF-8 bytes (so Unicode text, emoji, and non-Latin scripts round-trip correctly), then encodes those bytes to Base64, or reverses the process for decoding. Malformed Base64 input (invalid characters, invalid length, invalid padding, or bytes that don't form valid UTF-8 once decoded) is rejected rather than silently repaired.

Worked Examples

Encode 'hello'

  1. UTF-8 bytes of 'hello': 68 65 6c 6c 6f.
  2. Group bytes into 6-bit chunks and map each to a Base64 character.
  3. Result: aGVsbG8=

Decode 'aGVsbG8='

  1. Map each Base64 character back to its 6-bit value.
  2. Regroup bits into 8-bit bytes: 68 65 6c 6c 6f.
  3. Decode UTF-8 bytes to text: hello

Frequently Asked Questions

Is Base64 encryption?

No. Base64 is a reversible encoding with no key or secret involved. Anyone can decode Base64 text back to its original form, so it provides no confidentiality.

Why does decoding sometimes fail?

Decoding fails when the input is not valid Base64: it contains characters outside A-Z, a-z, 0-9, +, /, =, has an invalid length, has malformed padding, or the decoded bytes are not valid UTF-8 text.

Does this handle Unicode and emoji correctly?

Yes. Text is converted to UTF-8 bytes before encoding, and decoded bytes are parsed as UTF-8, so non-Latin scripts and emoji round-trip correctly.

What does an empty input produce?

Encoding empty text produces an empty Base64 result, and decoding an empty string produces empty text.