What base64 is, and the one thing it is not
Base64 takes three bytes and writes them as four characters from a 64-character alphabet: A-Z, a-z, 0-9, plus `+` and `/`. Three bytes is 24 bits, and four characters hold 24 bits, so nothing is lost - the output is just longer, by exactly a third. Padding with `=` at the end makes the length a multiple of four so that a decoder knows when to stop.
It is an encoding, not encryption, and the difference matters: anybody can decode base64 in one step, with no key and no effort. It exists because some channels carry text and not bytes - not because it hides anything. A password, a token or a private key written in base64 is exactly as readable as one written in plain text, which is worth remembering before a secret goes into a URL this way.
The alphabet is why the URL-safe variant exists. `+` and `/` mean something in a query string and in a file name, so RFC 4648 defines a second alphabet that swaps them for `-` and `_` and drops the padding. JWT parts use it, and so does anything meant to travel in a link intact. Both are accepted on the way in here; the choice only affects what comes out.