Base64 Encoder / Decoder
DataEncode any text or data to Base64, or decode Base64 strings back to plain text instantly. Free, client-side — nothing you paste is ever uploaded.
What is a Base64?
A Base64 Encoder / Decoder converts text to and from Base64 encoding — a scheme that represents binary or text data using only 64 safe ASCII characters (A–Z, a–z, 0–9, +, /) plus = for padding. Base64 was originally designed to allow binary file attachments to pass through email systems that only supported 7-bit ASCII text. Today it is ubiquitous in web development: HTTP Basic Auth headers, JWT tokens, data URIs for embedded images, and binary data in JSON APIs all rely on Base64.
This tool handles Unicode text correctly by encoding the input as UTF-8 bytes before applying Base64, ensuring that non-ASCII characters (accented letters, Indian scripts, emoji) are encoded faithfully and can be decoded back without loss. The encoder uses the standard Base64 alphabet; decoding accepts standard Base64 with or without padding.
Base64 is an encoding, not encryption — anyone who sees a Base64 string can decode it in seconds. If you need to protect data, use encryption separately from encoding.
For URL encoding needs, the URL Encoder / Decoder handles percent-encoding. For JSON formatting, see the JSON Formatter.
How to use this Base64 calculator
- Paste your input text (or Base64 string) into the Input field.
- Select Encode → Base64 or Decode ← Base64 from the Mode selector.
- The output appears instantly in the Output field.
- Click the copy icon on the output field to copy the result.
- For decoding, ensure the input uses only valid Base64 characters (A–Z, a–z, 0–9, +, /, =).
Formula & Methodology
Encoding (text → Base64): 1. Convert the input string to UTF-8 bytes (handles Unicode correctly) 2. Group bytes into 3-byte chunks 3. Convert each 3-byte chunk (24 bits) into four 6-bit values 4. Map each 6-bit value to a character in the Base64 alphabet (A–Z = 0–25, a–z = 26–51, 0–9 = 52–61, + = 62, / = 63) 5. Append=padding if the input length is not a multiple of 3 Decoding (Base64 → text): 1. Strip whitespace 2. Map each Base64 character back to its 6-bit value 3. Reassemble 6-bit groups into 3-byte chunks 4. Decode the bytes as UTF-8 text 5. Return a clear error if any character is outside the Base64 alphabet Valid example:Hello, World!→SGVsbG8sIFdvcmxkIQ==Invalid decode example:SGVsbG8!—!is not a valid Base64 character