What Base64 is for
Base64 represents binary data using only 64 safe printable characters: A-Z, a-z, 0-9, + and /, with = as padding. It is used wherever bytes have to travel through text-only channels: email attachments, data URLs, HTTP Basic authentication headers, JSON Web Tokens and configuration files. Every three bytes become four characters, so the encoded form is about 33 percent larger.
Choose Encode or Decode and type or paste your text. Text is converted to bytes with UTF-8 first, so accented letters, symbols and emoji round-trip correctly, which the browser's bare btoa function cannot do. The decoder accepts both the standard alphabet and the URL-safe variant (- and _ instead of + and /), ignores whitespace and line breaks, tolerates missing padding and strips a data:...;base64, prefix.
For URL-safe output tick the option; JWTs and many web APIs use this variant, usually without padding.
Worked example
The text héllo € contains two characters outside ASCII. In UTF-8 it is the bytes 68 C3 A9 6C 6C 6F 20 E2 82 AC, which encode to:
aMOpbGxvIOKCrA==
The two equals signs are padding, because the input length is not a multiple of three bytes. In URL-safe mode without padding the same bytes would be aMOpbGxvIOKCrA. Decoding the result returns the original text exactly.
Base64 is not encryption
Anyone can decode Base64, so it provides no secrecy. Do not use it to hide passwords or keys. If you decode something and see unreadable symbols, the bytes are probably binary data such as an image or a compressed file rather than text, and the tool says so instead of showing garbage. Basic authentication headers are a common example of decodable text: Authorization: Basic dXNlcjpwYXNz decodes to user:pass. For decoding tokens see the JWT decoder, and for percent-encoding see the URL encoder.
Frequently asked questions
Why does the encoded text end with = signs?
Base64 works on groups of three bytes. If the input does not fill the last group, one or two equals signs pad the output to a multiple of four characters. Many URL-safe uses omit the padding.
Does it handle emoji and non-English text?
Yes. Text is encoded as UTF-8 before conversion, so any Unicode character works, and decoding reverses the process exactly.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and /, which have special meaning in URLs. The URL-safe variant uses - and _ instead, so the result can appear in a URL or filename without extra escaping.
Can I encode a file or image?
This page converts text. For files, use a dedicated file-to-Base64 tool; for images you generally want a data URL. Pasting Base64 of an image into the decoder will tell you the bytes are not valid text.