Base64 Encoder / Decoder
Show the math
What Your Result Means
- Output: The encoded or decoded version of your input text. In encode mode, this is a Base64 string safe for use in URLs, emails, and data URIs. In decode mode, this is the original plaintext recovered from a Base64 string.
- Input Characters: The length of the text you entered.
- Output Characters: The length of the resulting string. Base64-encoded output is typically about 33% longer than the original because every 3 bytes become 4 characters.
How This Calculator Works
You paste text and choose Encode or Decode. In encode mode, the tool converts UTF-8 text into bytes, groups them into 6-bit chunks, and maps each chunk to a character in the Base64 alphabet (A–Z, a–z, 0–9, +, /). In decode mode, it reverses the process. Everything runs in your browser — no data is sent to a server.
Quick Questions
Is Base64 the same as encryption?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string without a key. It is used to safely transmit binary data over text-based channels, not to keep data secret.
Why is my Base64 output longer than the original?
Base64 represents every 3 input bytes as 4 output characters, producing roughly 33% overhead. Padding characters (=) may also be added to bring the output length to a multiple of 4.
Can I encode images or files with this tool?
This tool handles text input only. To Base64-encode a file, you would need to read it as raw bytes first. Many programming languages and CLI tools (like the base64 command on macOS/Linux) support file encoding directly.
What does "Invalid input" mean when decoding?
The input string contains characters outside the Base64 alphabet or has incorrect padding. Valid Base64 uses only A–Z, a–z, 0–9, +, /, and = for padding. Check for accidental spaces or line breaks.
Sources
- RFC 4648 — The Base16, Base32, and Base64 Data Encodings (official specification)
- Wikipedia — Base64 (overview and encoding table)
- MDN Web Docs — Base64 (JavaScript implementation reference)
Method & review
Estimate only. Results reflect your inputs and standard formulas. Double-check important decisions independently.