Match a job Paths Subjects Questions Quizzes Pricing
Intermediate Open Free

How Many URLs Fit in Six Characters

Your URL shortener uses codes drawn from [a-z A-Z 0-9] — 62 characters.

How many unique URLs can a 6-character code hold, and at 1,000 new URLs per second, how long until the keyspace runs out?

Show the arithmetic, and say whether you'd launch with 6 or 7 characters.

Solution

C) ~57 billion — which sounds infinite and runs out in under two years.

62⁶ = 62 × 62 × … × 62 = 56.8 billion combinations.

At 1,000 new URLs/second:

56.8 × 10⁹ ÷ 1,000/s ≈ 5.7 × 10⁷ seconds ≈ 657 days ≈ 1.8 years.

And that's the theoretical ceiling — random generation needs the keyspace to stay mostly empty to avoid collision retries, so the practical limit arrives even sooner. One more character fixes it: 62⁷ ≈ 3.5 trillion, or ~110 years at the same rate. That's why real shorteners standardized on 7.

The rule of thumb to say out loud: each base62 character multiplies capacity by 62 — 6 chars ≈ 57B, 7 chars ≈ 3.5T — so size the code to write rate × lifetime, then add one.

Worth naming in an interview: the counter-vs-random tradeoff (a global counter uses the keyspace densely but leaks creation order; random codes don't leak but collide as density grows), and that checking "does this code exist" is why generation strategy and keyspace sizing are the same conversation.

Share this question

← Back to Design a URL Shortener (bit.ly / TinyURL) practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.