How "café" becomes Y2Fmw6k=, one bit at a time
Base64 is easiest to understand by doing it once by hand. Take the word "café". A computer cannot store letters, only numbers, so the first step is to turn the text into bytes. The web uses UTF-8 for that, and in UTF-8 the plain letters c, a and f are one byte each: 63, 61 and 66 in hex. The é is not plain ASCII, so it takes two bytes, C3 and A9. Four characters have become five bytes. That one detail is behind most of the confusion about Base64 and Unicode, and we will come back to it.
Base64 then cuts those bytes into groups of three. Three bytes are 24 bits, and 24 bits divide evenly into four groups of 6 bits. Six bits can hold a number from 0 to 63, and each of those 64 numbers is given a character: A to Z are 0 to 25, a to z are 26 to 51, the digits are 52 to 61, and + and / are 62 and 63. The first three bytes, 63 61 66, are the bits 011000 110110 000101 100110, which are the numbers 24, 54, 5 and 38, which are the characters Y, 2, F and m. So "caf" becomes "Y2Fm".
Two bytes are left over, C3 and A9. That is 16 bits, so the encoder adds two zero bits to make 18, which is three groups of six: 48, 58 and 36, or w, 6 and k. One more character would be needed to finish a group of four, and the = sign fills that slot to say "nothing here". The full result is Y2Fmw6k=. You can type "café" into the box above and check it. Every 3 bytes became 4 characters, which is why Base64 is always about a third bigger than what it encodes.
Now the Unicode problem. JavaScript’s built-in btoa() function was written before UTF-8 won. It treats each character as one byte, so it accepts "é" (code 233, which fits in a byte) but produces a different answer from the one above: it encodes the single byte E9, not the two UTF-8 bytes. And for "€" or "😀", whose codes do not fit in a byte at all, it simply throws an error. A server in Python, Go or Java will decode Base64 to bytes and read them as UTF-8, so text encoded the btoa() way arrives mangled. This tool always encodes the UTF-8 bytes, so what you encode here decodes correctly anywhere else.
Base64 has limits that are worth being plain about. It is not encryption and not compression: it hides nothing from anyone who wants to read it, and it makes data bigger, not smaller. It is also not one format but a small family. Standard Base64 uses + and /, which mean something inside a URL, so the URL-safe variant swaps them for - and _ and usually drops the = padding. Some systems also break long Base64 into lines of 76 characters. The decoder here accepts all of those shapes, because Base64 rarely arrives in the form you expected. What it will not do is turn Base64 back into a file: if the bytes are an image or a PDF, it tells you so rather than pretending they are text.