Reading — step 1 of 5
Read
~1 min readVariants
Base64URL
Standard base64 uses + and /, both special in URLs. Base64url (RFC 4648 §5):
+becomes-/becomes_- Padding
=is OPTIONAL (often dropped to save chars)
Standard: SGVsbG8gV29ybGQ=
Base64url: SGVsbG8gV29ybGQ (no padding)
Or: SGVsbG8gV29ybGQ= (with padding)
Used in:
- JWT (header.payload.signature)
- URLs containing data
- File paths
Decoders must:
- Replace
-with+and_with/ - Add back the appropriate
=padding (based on length % 4) - Decode as standard base64
python
Other variants:
- Base32 (RFC 4648 §6): A-Z + 2-7, case-insensitive. Used for OTP secrets, Bitcoin addresses.
- Base16 = hex.
- Base58 (Bitcoin): no
0,O,I,lto avoid visual confusion. - Ascii85 / Base85: more efficient than base64 (5 chars per 4 bytes vs 4 per 3).
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…