Every long URL is associated with a key, which is the part after http://domain.tld/. For example http://tinyurl.com/m3q2xt has a key of m3q2xt.

There are several techniques to implement a shortening.

Keys can be generated numerically in base 36 assuming 26 letters and 10 numbers. The keys in order would be 0, 1, 2, ..., 9, a, b, ..., z. If uppercase and lowercase letters are accepted then the number should be in base 62 (26 + 26 + 10).

A hash function can be made or a random number can be generated so that key sequence is not predictable.

Users can propose their own keys. For example, http://francetwitter.blogspot.com/2009/12/germany-and-france-remain-non-commital.html can be shortened to http://247n.info/de0fr

Source:en.wikipedia.org/

There are several techniques to implement a shortening.

Keys can be generated numerically in base 36 assuming 26 letters and 10 numbers. The keys in order would be 0, 1, 2, ..., 9, a, b, ..., z. If uppercase and lowercase letters are accepted then the number should be in base 62 (26 + 26 + 10).

A hash function can be made or a random number can be generated so that key sequence is not predictable.

Users can propose their own keys. For example, http://francetwitter.blogspot.com/2009/12/germany-and-france-remain-non-commital.html can be shortened to http://247n.info/de0fr

Source:en.wikipedia.org/