Skip to content
FreeProgramming

Base64 Encoder / Decoder

Base64 turns binary or text data into a safe ASCII representation — handy for embedding data in URLs, JSON, or email. This tool encodes and decodes instantly in your browser, with proper UTF-8 handling so emoji and non-Latin scripts (Urdu, Arabic, Chinese…) work correctly — something naive encoders get wrong.

Text → Base64

How it works

  1. Choose Encode or Decode mode.
  2. Type or paste your input.
  3. The output updates instantly as you type.
  4. Encode converts text → Base64; Decode converts Base64 → original text.
  5. Invalid Base64 input produces a clear, friendly error instead of garbage.

The formula

How it works

text → UTF-8 bytes → 6-bit groups → Base64 alphabet

Each 3 bytes become 4 Base64 characters; padding '=' fills the final group. Decoding reverses the steps exactly.

Worked example

Worked example

  1. Input: Hello, StudentKit!
  2. Base64: SGVsbG8sIFN0dWRlbnRLaXQh

Decoding SGVsbG8sIFN0dWRlbnRLaXQh returns the original string byte-for-byte.

Common mistakes

  • Using String.fromCharCode/btoa directly on unicode — it corrupts non-Latin text. This tool uses the UTF-8-safe path.
  • Copying Base64 with line breaks or extra whitespace — the decoder strips harmless whitespace automatically.
  • Assuming Base64 is encryption — it's an encoding; anyone can decode it. Never put secrets in Base64.

Frequently asked questions

Is Base64 the same as encryption?

No — Base64 is reversible encoding, not security. Anyone can decode it. Never store passwords or tokens in Base64.

Why does my Base64 have = at the end?

Padding. Base64 groups bytes in threes; '=' characters pad the final group when the input length isn't divisible by three.

Does it work with non-English text?

Yes — encoding uses UTF-8, so Urdu, Arabic, Chinese, emoji and accented characters all survive the round trip correctly.

Where would a student use this?

Embedding images in HTML/CSS, passing data in URL query strings, reading API payloads, and understanding how email attachments are stored.

Students who used Base64 Encoder / Decoder also reach for these.

View all tools