What makes a good API key?
A good API key has high entropy, is long enough to resist brute-force, and uses a charset that's URL-safe. A 256-bit key (32 bytes) in Base64 is 43 characters — sufficient for virtually any application.
- Hex: 64 chars for 256 bits — simple, double the length
- Base64: 43 chars for 256 bits — compact, may need URL-safe variant
- Base64URL: 43 chars for 256 bits — safe in URLs and JSON
- Custom alphabet: variable — useful for readable keys