Base64 guide
What is Base64 used for?
Base64 represents a sequence of bytes using printable ASCII characters. It is useful when a system expects a text value but the data you need to send includes arbitrary bytes. You might encounter it in email attachments or in an API that carries binary data in a JSON string. For everyday text in a system that already supports UTF-8, you can usually send the text as it is.
A Base64 string carries the original bytes. It provides no confidentiality. Anyone with the encoded value can recover those bytes without a key. Encryption uses a key to protect information. Treat a Base64 copy of a password or access token with the same care as the original.
Encode text and decode it back
Choose Encode and enter “Hello” to get “SGVsbG8=”. Copy that value, switch to Decode, and paste it into the input. The result is “Hello”. Keep the final equals sign when copying the encoded value. Quotation marks here show where the examples begin and end, so leave them out of the input.
Conversions in Bash64 run in your browser. To test a line break, type “Hello” on the first line and “World” on the second, with a single line feed between them and no final newline. Those bytes encode as “SGVsbG8KV29ybGQ=”. When you decode that value, the result appears on two lines. A trailing space or a different line ending changes the bytes and therefore the encoded result.
How UTF-8 handles accents, Chinese and emoji
Bash64 encodes text as UTF-8 bytes and then represents those bytes as Base64. Decoding reverses these steps. UTF-8 uses one byte for each ASCII character and up to four bytes for other Unicode code points, so the length of a Base64 value depends on the byte count. For example, “café” becomes “Y2Fmw6k=”, “你好” becomes “5L2g5aW9”, and “🙂” becomes “8J+Zgg==”.
If a Base64 value decodes to invalid UTF-8, check what produced it. The bytes might contain a binary file or text in another character encoding. If you control the source, export the text as UTF-8 before applying Base64. Base64 padding describes the last group of bytes. To change their character encoding, go back to the original text.
What the equals signs mean
Standard Base64 groups the original bytes in threes. Each full group produces four encoded characters. When one byte remains, the last group ends in two equals signs. When two bytes remain, it ends in one. Compare “f” → “Zg==”, “fo” → “Zm8=”, and “foo” → “Zm9v”. The equals signs complete the final group and tell the decoder how many bytes to recover.
Keep the padding supplied by the encoder unless the receiving format explicitly calls for an unpadded value. If you copied a value from another system, use its format specification to check whether the padding was intentionally omitted.
Standard Base64 and Base64URL
The standard alphabet includes uppercase and lowercase ASCII letters, digits, plus (+), and slash (/). Base64URL replaces plus and slash with hyphen (-) and underscore (_) so the alphabet works in URLs and filenames. Whether Base64URL includes padding depends on the format that uses it. Bash64’s text converter uses standard Base64. Check the format required by the service that will read your value before using it in a URL.
Frequently asked questions
Why does my pasted Base64 value fail to decode?
Check that you copied the complete value and preserved its capitalization. Remove surrounding quotes or a label from a copied example. If the source wraps the encoded text across lines, try copying the raw value as one continuous string. Some formats permit whitespace in encoded data. For standard Base64 input, use the alphabet above and keep any required equals signs at the end.
Can two pieces of text that look the same encode differently?
Yes. For example, Unicode can represent an accented letter as one code point or as a letter followed by a combining accent. Both can look identical on screen while producing different UTF-8 bytes. Invisible differences such as spaces at the end of a line can also change the result.
Does Base64 compress data?
Base64 expands data. Three input bytes become four ASCII characters, so the output is roughly a third larger for long inputs. Very short inputs can grow proportionally more because the padded result comes in groups of four. If a protocol compresses data before applying Base64, compression is a separate step.