Base64 Encode / Decode converts text to Base64 and Base64 back to readable text, with full UTF-8 support for accents, emoji, and non-Latin scripts. Developers use it to read encoded API fields, build HTTP Basic auth headers, and inspect data URIs and email attachments.
Input
hello (Encode)
Output
aGVsbG8=
Input
café ☕ (Encode)
Output
Y2Fmw6kg4piV
Input
SGVsbG8sIFdvcmxkIQ== (Decode)
Output
Hello, World!
Input
aGVsbG8 (Decode, padding missing)
Output
hello
Base64 represents binary data using 64 printable characters: A to Z, a to z, 0 to 9, plus + and /. Every 3 bytes of input become 4 characters of output, so encoded data is about 33% larger than the original. When the input length is not a multiple of 3, the output is padded with = signs: one = means the last group had 2 bytes, two == means it had 1. That is why "hello" (5 bytes) encodes to aGVsbG8= with a single pad character.
Text is converted to UTF-8 bytes before encoding. That matters because the browser's built-in btoa function only accepts characters up to code point 255 and throws an error on anything else. Encoding the bytes first means "café ☕" works: é becomes the two bytes C3 A9 and the coffee cup becomes three bytes, giving Y2Fmw6kg4piV. Decoding reverses the process and reads the bytes as UTF-8, so any text encoded by another UTF-8 tool, such as Python's base64 module or the base64 command on Linux and macOS, decodes back to the same characters.
Decoding is forgiving about formatting but strict about the alphabet. Missing = padding is accepted, so aGVsbG8 decodes to hello, and spaces or line breaks inside the input, common in email (MIME) Base64 wrapped at 76 characters, are ignored. Characters outside the standard alphabet are rejected. That includes - and _ from Base64url, the URL-safe variant used in JWTs; replace - with + and _ with / first, or use the JWT decoder for tokens. If the decoded bytes are not valid UTF-8, such as an encoded image, the output will contain replacement characters (�), which means the data is binary rather than text.
Base64 is an encoding, not encryption. Anyone can decode it, so it does not protect passwords or API keys; HTTP Basic auth headers, for example, are only Base64 of user:password and must be sent over HTTPS. For files and images use image to Base64, which builds a complete data URI. To make text safe for a query string instead, use URL encode / decode.
More Developer Tools