Base64 Encoder / Decoder

Encode plain text to Base64 and decode Base64 back into readable text directly in your browser.

Input

0 characters

Output

0 characters

How it works

Browsers provide `btoa()` and `atob()` for Base64 encoding and decoding, but these functions are byte-oriented and can fail with non-ASCII text unless you first convert text through UTF-8 bytes. This tool uses `TextEncoder` and `TextDecoder` around those browser APIs so Unicode text like Hindi, emojis, and accented characters can be handled safely in normal browser workflows.

  • Use Encode to Base64 to convert text into a Base64 string.
  • Use Decode Base64 to turn valid Base64 text back into readable text.
  • UTF-8-safe handling is important because direct `btoa()` / `atob()` alone are not enough for arbitrary Unicode input.

Common use cases for Base64

  • Embedding small images directly in CSS or HTML using data URIs.
  • Encoding email attachments in MIME messages (SMTP is text-based).
  • Storing binary data like tokens or credentials inside JSON payloads.
  • Passing data safely inside URLs where certain characters aren't allowed.

Frequently Asked Questions

Base64 converts binary or text data into printable ASCII characters, making it safe to transmit over text-based protocols like email, JSON, or URLs.

No, Base64 provides no security. It's a reversible encoding scheme — anyone can decode it back to the original form without a password or key.

Decoding fails when input isn't valid Base64 — invalid characters, incorrect padding, or when the text was actually plain text rather than encoded data.

Yes, this tool uses TextEncoder and TextDecoder to safely convert Unicode text through UTF-8 bytes before encoding, so emojis and Hindi text work correctly.

The browser's built-in btoa() only works correctly with single-byte Latin1 characters. Multi-byte Unicode text needs UTF-8 conversion first, or btoa() throws an error or gives incorrect output.

Yes, Base64 increases data size by roughly 33% since every 3 bytes of binary data is represented using 4 ASCII characters. This is expected overhead for safe text transmission.