What is Base62 Encoding?
2026-03-15
Base62 encoding represents binary data using 62 alphanumeric characters: digits 0–9, uppercase A–Z, and lowercase a–z. The result is a compact, URL-safe string with no special characters that need escaping.
How Base62 Works
Base62 converts a number (or byte sequence) into a string using a 62-character alphabet. Each position in the output represents a power of 62, similar to how decimal uses powers of 10 and hexadecimal uses powers of 16. The encoding is reversible—you can decode a Base62 string back to the original number or bytes.
For example, the decimal number 999 in Base62 becomes g7 (16 × 62 + 7 = 999). This compression makes Base62 ideal for creating short identifiers.
Base62 vs Base64
| Feature | Base62 | Base64 |
|---|---|---|
| Characters | 0-9, A-Z, a-z (62) | A-Z, a-z, 0-9, +, / (64) |
| URL safe | Yes | No (+ and / need encoding) |
| Padding | None | = padding common |
| Best for | Short URLs, IDs, API keys | Binary data, email, JSON |
When to Use Base62
- Short URLs: URL shorteners like bit.ly use Base62-style encoding to create compact links from numeric IDs.
- Database IDs: Instead of exposing auto-increment integers, encode them as Base62 strings for shorter, opaque identifiers.
- API keys and tokens: Base62 strings are safe in URLs, headers, and query parameters without escaping.
- File naming: Generate compact, unique filenames that work on all operating systems.
Try It Online
Use our Base62 Encoder to encode text to Base62, or our Base62 Decoder to decode Base62 strings. Both run in your browser—no data leaves your device. Check our full Encoders & Decoders category for Base64, URL, HTML, and more.