How to Design a URL Shortener: Requirements and Capacity Estimation

System design walkthrough for a URL shortener like TinyURL: functional and non-functional requirements, traffic, storage and bandwidth estimates.

Published November 27, 2026

Designing a URL shortener is the classic first system design problem, and for good reason. The product is tiny (turn a long URL into a short one and redirect), yet doing it for billions of links touches every core topic: ID generation, databases, caching, sharding and analytics. This first part covers the step everyone rushes: requirements and back-of-the-envelope estimation.

The concept

Start by pinning down what the system must do. The core functional requirements are: given a long URL, return a unique short URL; given a short URL, redirect to the original. Common extras include custom aliases (example.com/summer-sale), expiration dates, click analytics, and user accounts to manage links. Agree on which extras are in scope before drawing anything.

Then the non-functional requirements, which shape the architecture far more. Redirects must be very fast (users notice anything over about 100 ms) and highly available, because a broken short link in a printed flyer or a tweet cannot be fixed. Short codes should not be guessable in sequence if links might be private. The system is extremely read-heavy: a link is created once and clicked many times.

Requirements

TypeRequirementWhy it matters
FunctionalShorten a long URL to a unique short codeCore feature
FunctionalRedirect short code to original URLCore feature
FunctionalOptional custom alias and expiryAffects uniqueness checks and cleanup jobs
FunctionalClick analytics per linkAdds a write on every read
Non-functionalRedirect p99 latency < 50 ms server-sideDrives caching strategy
Non-functional99.99% availability for redirectsDrives replication and multi-region
Non-functionalShort codes not enumerableDrives ID generation choice
Non-functionalDurable: links live for yearsDrives storage and backup

Back-of-the-envelope estimation

Assume 100 million new links per month and a 100:1 read-to-write ratio. Those two numbers drive everything else; write the arithmetic down so the interviewer (or your team) can check it.

  • Writes: 100M / (30 × 86,400 s) ≈ 40 new links per second on average, maybe 400/s at peak
  • Reads: 100 × 40 ≈ 4,000 redirects per second on average, tens of thousands at peak
  • Storage per link: code (7 B) + long URL (avg ~100 B) + metadata (~100 B) ≈ 250-500 B
  • Five years: 100M × 12 × 5 = 6 billion links × 500 B ≈ 3 TB of link data
  • Code length: 62^7 ≈ 3.5 trillion combinations, far more than 6 billion, so 7 Base62 characters are plenty
  • Cache: about 20% of links get 80% of clicks; caching the hottest ~20% of a day's reads takes only a few GB of RAM

Where the load is

Redirects (reads)≈4,000/s avgAnalytics events≈4,000/sNew links (writes)≈40/s
Average request rates for 100M new links/month at 100:1 read/write.

The critical path

HTTPSroutelookupClientGET /aZ3kP9qLoad balancerRedirect servicecache → DBLink storecode → URL
The read path is the one to optimise: it carries ~99% of traffic.

Practical examples

Estimation as code

Keeping the numbers in a tiny script makes it easy to try other assumptions.

links_per_month = 100_000_000
read_ratio = 100
writes_per_s = links_per_month / (30 * 86_400)
reads_per_s = writes_per_s * read_ratio
bytes_per_link = 500
storage_5y_tb = links_per_month * 12 * 5 * bytes_per_link / 1e12
print(f"{writes_per_s:.0f} writes/s, {reads_per_s:.0f} reads/s, {storage_5y_tb:.1f} TB in 5 years")
# 39 writes/s, 3858 reads/s, 3.0 TB in 5 years

How many characters do you need?

Find the smallest length whose Base62 space comfortably exceeds expected links.

import math
needed = 6_000_000_000 * 100          # 100x headroom
print(math.ceil(math.log(needed, 62)))  # 7

Clarifying questions to ask first

Each answer changes the design.

- How many new links per day? How many clicks?
- Can users choose custom aliases? Can links be edited or deleted?
- Do links expire? Is analytics real-time or daily?
- Are links public, or must they be unguessable?
- Single region or global users?

Common mistakes

  • Jumping straight to databases and caches before agreeing on requirements and scale.
  • Ignoring the read/write ratio, which is the single most important number for this system.
  • Choosing a code length without doing the combinatorics.
  • Forgetting analytics turns every read into a write somewhere.
  • Over-designing for scale nobody asked for; state your assumptions instead.

Key takeaways

  • Clarify functional scope (aliases, expiry, analytics) before designing.
  • The system is heavily read-dominated; optimise the redirect path.
  • 7 Base62 characters give about 3.5 trillion codes, plenty for billions of links.
  • A few terabytes over five years fits comfortably in a sharded or even a single large database.

FAQ

Why is a URL shortener a popular interview question?

It is small enough to finish in 45 minutes but touches hashing, ID generation, storage, caching, scaling and trade-offs.

What read/write ratio should I assume?

Anything from 10:1 to 1000:1 is reasonable; state your assumption clearly. 100:1 is a common middle ground.

Do I need to estimate bandwidth?

Briefly: a redirect response is a few hundred bytes, so even 40,000 per second is only around 10-20 MB/s. Bandwidth is not the bottleneck here.

More Architecture articles