System DesignMedium88% interview frequency · Last seen 2025-12

Design a URL Shortener

Problem

Design a URL shortening service like bit.ly.


Requirements:

- Given a long URL, return a unique short URL

- Redirect short URL to original long URL

- Short codes should be as compact as possible

- Handle high read traffic (100:1 read/write ratio)

- Optional: custom aliases, expiration, analytics


Walk through API design, data model, encoding strategy, and scaling considerations.

Common follow-ups

  • How do you prevent malicious URLs?
  • How would you generate unique codes at scale without collisions?

Practice

Sign in to unlock practice

Create a free account for full access through 2027 — study guides, follow-ups, and an in-browser code editor. Part of our AI bubble promotion; feedback is appreciated.