What Base64 actually does
Base64 converts binary data into text using 64 ASCII characters: A–Z, a–z, 0–9, +, and /. Every three bytes become four encoded characters. This makes binary data easier to transport through systems designed around text, such as email, JSON, XML, HTTP headers, and some configuration formats.
The output is larger than the input—about 33 percent before line breaks—because eight-bit bytes are represented with six-bit groups. Base64 is a representation change, not compression and not encryption.
Why padding appears at the end
Because input length may not divide evenly into three-byte groups, Base64 uses = characters as padding. One equals sign means the final group represents two bytes; two equals signs mean it represents one byte. Some systems omit padding to save characters, especially in URLs, but decoders may require it to be restored.
If decoding fails, check whether the value was copied completely. A missing final character or padding can make the entire value invalid even though the beginning looks correct.
Unicode and browser encoding
Base64 operates on bytes, not human characters. Text must first be encoded as bytes, usually UTF-8. Older browser examples that call btoa directly can fail on non-ASCII input because btoa expects a binary string rather than a Unicode string. A correct workflow encodes text with TextEncoder first, then Base64-encodes the bytes.
Decoding reverses that process: decode Base64 to bytes, then interpret the bytes as UTF-8 with TextDecoder. The Base64 tool on this site follows that pattern so multilingual text is handled safely.
Base64Url and reserved characters
Standard Base64 uses +, /, and =, which can be inconvenient in URLs and filenames. Base64Url replaces + with -, replaces / with _, and commonly omits padding. JSON Web Tokens use Base64Url for their header, payload, and signature segments.
Base64Url is not more secure; it is simply friendlier to transport contexts. If you need to place a value in a query parameter, also understand URL encoding. Base64Url reduces some conflicts, but application code still has to encode and decode values at the correct boundaries.
Base64 is not encryption
Anyone who recognizes Base64 can decode it instantly. Encoding does not require a key, does not prove authenticity, and does not protect confidentiality. Never treat a Base64-encoded password, token, or secret as protected. If data needs confidentiality, use authenticated encryption and proper key management. If integrity matters, use a signature or message authentication code.
This distinction matters in debugging. A JWT payload may be Base64Url-decoded for inspection, but the token should still be handled like a credential because applications use it to authorize requests. Decoding is not validation.
When Base64 is useful
Base64 is appropriate for embedding small binary assets in text formats, representing bytes in JSON, creating data URIs, and transporting values through systems that reject arbitrary binary. It is less appropriate for large files because the size expansion and memory overhead can be significant.
For everyday development, use a local encoder for inspection and testing. Keep large production conversions in a controlled application or build pipeline where input size, character encoding, and error handling are explicit.
Conclusion
Base64 is a useful text representation for bytes. Understand padding, UTF-8 boundaries, URL-safe variants, and size overhead—and never confuse encoding with security.