</>
ShikshaCSLearn. Code. Grow.
🔍
☕ Support Us
ShikshaCSâ€ēPractice Problems
Software EngineeringHardSystem Design

Design a URL Shortener (High Level)

📋 Problem

At a high level, design a URL shortener service (like bit.ly) — how would it generate short codes and redirect users?

🧭 Approach

Store each long URL in a database with an auto-incrementing ID. Convert that ID into a short base-62 encoded string (using a-z, A-Z, 0-9) to form the short code — this guarantees uniqueness without extra lookups. When someone visits the short URL, look up the code in the database and issue an HTTP redirect (302) to the original long URL.

← Back to all Problems