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?
Solution
# Solution locked # Sign in to unlock expert solutions # with multi-language code and analysis
Sign in to unlock
Create a free account to preview problems. Subscribe for full access to our curated bank — expert tutorials, follow-ups, and practice tools you won't find on public sites.