How long should a short code be, if it uses letters and digits?
Sketch your own answer first, then compare it with the one below.
A strong answer
Letters in both cases and digits give 62 symbols. Six characters give 56 billion codes and seven give 3.5 trillion.
Pick a length so the number of links you expect is a tiny share of the space. Random codes also need a collision check, so extra room keeps retries rare. The trade-off is a longer link.
Sources
- Roy Fielding, Mark Nottingham, Julian Reschke (2022). RFC 9110: HTTP Semantics.