GUIDE深度 · Deep dive
URL-Safe Base64
Standard Base64 uses + and /, which need escaping in URLs, so the URL-safe variant uses - and _ and often drops trailing =. To decode, map them back to +/ and restore padding.
Character mapping
Standard: A-Z a-z 0-9 + /, with = padding.
URL-safe: + to -, / to _, with optional = padding.
JWTs and file names
JWTs use Base64URL, with three dot-separated segments.
Avoid / and = in file names; URL-safe is safer.
FAQ
Can I decode without =?
Yes; restore padding to a multiple of four before decoding.
Can I convert between them?
Yes; map the characters and handle padding.