Design a URL Shortener: System Design Interview Practice

Design a URL Shortener as a system design interview question: Users paste a long URL and get a short one; opening the short link redirects to the original.

How do you answer "Design a URL Shortener" in a system design interview?

Generate a unique ID for each long URL, encode it in base62 to get a short code of six or seven characters, and store code and URL in a key-value store. On a read, look the code up in a cache, falling back to the database, and answer with an HTTP 301 or 302 redirect. Reads far outnumber writes, so caching and replication carry the load.

  • Level: Beginner
  • Scored out of: 100
  • Cost: Free to read; a free account gets the review

Users paste a long URL and get a short one; opening the short link redirects to the original.

The scale

100 million new links a month, read 100 times more often than they are written; links live for years.

What a strong answer covers

  1. Requirements (20 points). States the functional requirements in scope and the non-functional ones that drive the design (scale, latency, availability, consistency), and leaves out what is out of scope.
  2. Scale estimates (15 points). Turns the stated scale into requests per second (average and peak), storage and bandwidth, with the arithmetic shown, and uses the numbers to make a decision.
  3. API and data model (20 points). Defines the main API calls with their inputs and outputs, and a data model whose keys and store fit the access patterns.
  4. Architecture (25 points). Chooses components that fit the requirements and explains how a request moves through them, for the main read and write paths.
  5. Bottlenecks and trade-offs (20 points). Names the real bottlenecks and failure points at this scale and how the design handles them, weighing the alternatives (consistency vs availability, push vs pull, cost).

How the practice works

Write your design in sections — functional and non-functional requirements, scale estimates, the API, the data model, the request flow and a deep dive on the bottlenecks — and pick the components to draw the architecture. A review scores it on the five areas above in under a minute, then you can defend it in an AI mock interview.

The reference design

Design a URL Shortener: the walkthrough, with animated figures.

Common questions

How do you answer "Design a URL Shortener" in a system design interview?

Generate a unique ID for each long URL, encode it in base62 to get a short code of six or seven characters, and store code and URL in a key-value store. On a read, look the code up in a cache, falling back to the database, and answer with an HTTP 301 or 302 redirect. Reads far outnumber writes, so caching and replication carry the load.

What scale is "Design a URL Shortener" designed for here?

100 million new links a month, read 100 times more often than they are written; links live for years. Your estimates turn that into requests per second, storage and bandwidth before you pick components.

How is a design scored?

Out of 100 on a fixed rubric: requirements (20), scale estimates (15), api and data model (20), architecture (25), bottlenecks and trade-offs (20). The review names what the design covered and what it missed, then points to the reference design.

Is "Design a URL Shortener" a good first system design problem?

Yes. It is rated beginner: few components, a clear read and write path, and the classic estimates every later problem builds on.

Do I need an account?

Not to read the problem or the reference design. Getting your design reviewed needs a free account.

More design problems