Video in progress

How many unique links does a 7-character base62 code hold, and is that enough?

62⁷ ≈ 3.5 trillion combinations. Even at 100 million new links a day, that lasts more than 90 years. 6 characters give ~57 billion — enough for a smaller service.

📖 Answer

The math:

62^6 = 56,800,235,584        ≈ 5.7 × 10^10
62^7 = 3,521,614,606,208     ≈ 3.5 × 10^12

100 million links a day: 3.5 × 10^12 / 10^8 = 35,000 days ≈ 96 years

Why base62? Digits (10) + lowercase letters (26) + uppercase letters (26) = 62 characters, all of which work in a URL without special encoding. Base64 has + and /, which cause trouble in URLs.

One subtle point: if codes are generated randomly, the chance of a collision grows as free space shrinks. So you don't plan to fill the whole space — while only a small share of the combinations is taken, collisions are rare and a single retry is enough.

Sometimes confusing characters (0/O, 1/l/I) are removed — that reduces mistakes when a user types the link by hand. The alphabet gets smaller, so you have to make the code a bit longer.