What Base64 does
Base64 writes any sequence of bytes using only 64 safe characters: the capital letters A to Z, the small letters a to z, the digits 0 to 9, and the plus sign and slash. Every 3 bytes of input become 4 Base64 characters, so encoded data is about a third longer than the original. When the input length is not a multiple of 3, one or two equals signs pad the end so the output length is a multiple of 4.
It is an encoding, not encryption. Anyone can decode Base64, so it hides nothing. Developers use it to carry bytes through places that only accept plain text, such as data URLs, email attachments, JSON fields, HTTP basic authentication headers and configuration files.
How text becomes bytes
Base64 works on bytes, so text is first turned into bytes using UTF-8, the encoding used by almost every web page and API. Plain English letters take one byte each, an accented letter such as é takes two, and most emoji take four. That is why the example, "Hello, world! Café ☕", has 20 characters but 23 UTF-8 bytes, and encodes to 32 Base64 characters.
When decoding, the bytes must form valid UTF-8 to be shown as text. If they do not, the Base64 probably holds an image, a compressed file or other binary data, and the tool says so rather than showing broken characters.
Standard and URL-safe Base64
The plus sign and slash have special meanings in web addresses and file names, so RFC 4648 also defines a URL-safe alphabet that uses a hyphen and an underscore in their place. JSON Web Tokens and many web APIs use this form, usually without the equals-sign padding. Turn on the URL-safe option to produce it.
The decoder accepts both alphabets, with or without padding, and ignores spaces and line breaks, so you can paste Base64 that was wrapped at 64 or 76 characters per line, as in email and PEM certificate files. It refuses a string that mixes the two alphabets, because that usually means two different values were pasted together.