# How do URL shorteners work?

**URL:** <https://boards.straightdope.com/t/how-do-url-shorteners-work/559787>\
**Category:** Factual Questions\
**Created:** [November 7, 2010, 1:21pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787 "2010-11-07T13:21:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![twickster](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@twickster](https://boards.straightdope.com/u/twickster)\
**Post date:** [November 7, 2010, 1:21pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/1 "2010-11-07T13:21:09Z")

</div>

As a recent convert to the twitterverse, I’m now using URL shorteners. I use bit.ly, which will take something like this:

[http://chronicle.com/article/50-Years-of-Stupid-Grammar/25497](http://chronicle.com/article/50-Years-of-Stupid-Grammar/25497)

and turn it into:

[http://bit.ly/bTTwD](http://bit.ly/bTTwD)

How does that work? (When you explain this, keep in mind that I have only the vaguest idea how a regular URL works, so please don’t get supertechnical.) My understanding is that a regular address takes you to a server where someone posted something. Where does the shortened address take you? To the bit.ly server, which then redirects?

---

<div class="post-metadata">

**Author:** ![Joey\_P](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Joey\_P](https://boards.straightdope.com/u/Joey_P)\
**Post date:** [November 7, 2010, 1:23pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/2 "2010-11-07T13:23:09Z")

</div>

I think you got it. My understanding is that the second link takes you to the bit.ly server, where it looks up bTTwD. At that location it finds a forward to your first link.

---

<div class="post-metadata">

**Author:** ![jjimm](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jjimm](https://boards.straightdope.com/u/jjimm)\
**Post date:** [November 7, 2010, 1:28pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/3 "2010-11-07T13:28:04Z")

</div>

That’s it.

And there is an advantageous byproduct of this: if you sign up for a free account with bit.ly, the bit.ly server can track how many people clicked through the bit.ly server to your link. It’s handy for marketing via Twitter and so on, or just for fulfilling your curiosity.

---

<div class="post-metadata">

**Author:** ![twickster](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@twickster](https://boards.straightdope.com/u/twickster)\
**Post date:** [November 7, 2010, 1:34pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/4 "2010-11-07T13:34:14Z")

</div>

Yeah, I was aware of the counting feature, which I’ve checked out for things I’ve tweeted. Since the link I just “created” had 622 hits before I posted, I infer that they don’t create a new link every time someone requests one.

ETA: Thanks!

---

<div class="post-metadata">

**Author:** ![Musicat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/musicat/32/20189_2.png) [@Musicat](https://boards.straightdope.com/u/Musicat)\
**Post date:** [November 7, 2010, 1:59pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/5 "2010-11-07T13:59:32Z")

</div>

On reason the URLs can be shorter is they make use of more symbols in the ASCII set than just lower case letters like a typical URL. Youtube does something like this, too.

Most web URLS are drawn from 26 letters plus 10 digits. Upper & lower case are equivalent, so you only have about 36 distinctive characters available for each place (some other chars can be used, but I’m not sure how many, so it’s a little more than 36). But if you make a distinction between lower & upper, you have 26 more chars to play with without expanding the length of the URL.

And the URL created doesn’t have to make any sense to humans; all combinations of letters/numbers are usable.

So UrL4W can be a different addr from uRl4w.

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [November 7, 2010, 3:14pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/6 "2010-11-07T15:14:09Z")

</div>

52^5 is 380 million so they can stay in business for a long time.

In reality, though, I doubt that even 1 million people have used the service, so they could just as easily used numbers from 000001 to 999999 and gotten the same result. Adding a seventh number would last ten times as long. Etc.

Probably doesn’t look as cool, though. 🆒

---

<div class="post-metadata">

**Author:** ![Musicat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/musicat/32/20189_2.png) [@Musicat](https://boards.straightdope.com/u/Musicat)\
**Post date:** [November 7, 2010, 3:35pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/7 "2010-11-07T15:35:20Z")

</div>

> [@Exapno\_Mapcase](#):
>
> 52^5 is 380 million so they can stay in business for a long time.
> 
> In reality, though, I doubt that even 1 million people have used the service, so they could just as easily used numbers from 000001 to 999999 and gotten the same result. Adding a seventh number would last ten times as long. Etc.
> 
> Probably doesn’t look as cool, though. 🆒

Assuming BOTH letters and numbers can be used, at least, that would be a 62 character set, not just 52 (26+26+10).

And it is possible that every user needs several URLS, so they might be used up a bit faster than you are calculating.

---

<div class="post-metadata">

**Author:** ![RealityChuck](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/realitychuck/32/195_2.png) [@RealityChuck](https://boards.straightdope.com/u/RealityChuck)\
**Post date:** [November 7, 2010, 4:44pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/8 "2010-11-07T16:44:33Z")

</div>

Tinyurl, one of the oldest of thesem, started with five letters after the [tinyurl.com](http://tinyurl.com). Now there are seven characters (it’s not case-sensitive, so it has fewer options). Bit.ly will start doing the same over time – their URLs will grow longer. But not as long as most of the originals.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [November 7, 2010, 5:23pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/9 "2010-11-07T17:23:14Z")

</div>

> [@](#):
>
> Most web URLS are drawn from 26 letters plus 10 digits. Upper & lower case are equivalent, so you only have about 36 distinctive characters available for each place (some other chars can be used, but I’m not sure how many, so it’s a little more than 36). But if you make a distinction between lower & upper, you have 26 more chars to play with without expanding the length of the URL.

Note that the domain name (the part before the slash, usually ending in .com or .org or .edu or whatever), which roughly speaking says what computer the site is on, is always case-insensitive. For the rest of the URL, describing which file and where on that computer, it depends on the OS and webhosting software that computer is running. Windows-based machines are case insensitive, and Unix-based machines are case sensitive, but the web server software will often tweak things so it behaves as if it weren’t.

---

<div class="post-metadata">

**Author:** ![foolsguinea](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/foolsguinea/32/14751_2.png) [@foolsguinea](https://boards.straightdope.com/u/foolsguinea)\
**Post date:** [November 7, 2010, 6:04pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/10 "2010-11-07T18:04:53Z")

</div>

I’m still puzzled at why you would take a descriptive URL & replace it with noise.

---

<div class="post-metadata">

**Author:** ![Gorsnak](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gorsnak/32/7587_2.png) [@Gorsnak](https://boards.straightdope.com/u/Gorsnak)\
**Post date:** [November 7, 2010, 6:20pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/11 "2010-11-07T18:20:17Z")

</div>

> [@foolsguinea](#):
>
> I’m still puzzled at why you would take a descriptive URL & replace it with noise.

Because this link:

> [@](#):
>
> [noparse][http://www.tigerdirect.ca/applications/Category/guidedSearch.asp?CatId=10&sel=Detail;30\_1225\_6870\_6870,Detail;30\_1198\_1942\_1942,Detail;30\_1199\_8391\_8391,Detail;30\_1226\_1506\_1506,Price;Price4,Mfr;Mfr\_1499[/noparse]](http://www.tigerdirect.ca/applications/Category/guidedSearch.asp?CatId=10&sel=Detail;30_1225_6870_6870,Detail;30_1198_1942_1942,Detail;30_1199_8391_8391,Detail;30_1226_1506_1506,Price;Price4,Mfr;Mfr_1499%5B/noparse%5D)

is not a descriptive url and is way too long to tweet.

---

<div class="post-metadata">

**Author:** ![Absolute](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Absolute](https://boards.straightdope.com/u/Absolute)\
**Post date:** [November 7, 2010, 6:21pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/12 "2010-11-07T18:21:42Z")

</div>

> [@foolsguinea](#):
>
> I’m still puzzled at why you would take a descriptive URL & replace it with noise.

Because Twitter is stupid.

---

<div class="post-metadata">

**Author:** ![choie](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/choie/32/7829_2.png) [@choie](https://boards.straightdope.com/u/choie)\
**Post date:** [November 7, 2010, 7:53pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/13 "2010-11-07T19:53:09Z")

</div>

A nice thing Bit.ly offers is the ability to customize your shortened version. So instead of some mishmash you can have [http://bit.ly/something](http://bit.ly/something). (E.g. when I was promoting a video related to a book trailer, I used nwvideo – “nw” being short for the book title. It’s recognizable and still shorter than the original link.)

---

<div class="post-metadata">

**Author:** ![jjimm](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jjimm](https://boards.straightdope.com/u/jjimm)\
**Post date:** [November 7, 2010, 8:01pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/14 "2010-11-07T20:01:57Z")

</div>

> [@twickster](#):
>
> Yeah, I was aware of the counting feature, which I’ve checked out for things I’ve tweeted. Since the link I just “created” had 622 hits before I posted, I infer that they don’t create a new link every time someone requests one.

Strange, the ones that I’ve done under my own account are only counted for me, not for others who’ve already done the URL compression.

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [November 7, 2010, 8:33pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/15 "2010-11-07T20:33:51Z")

</div>

> [@foolsguinea](#):
>
> I’m still puzzled at why you would take a descriptive URL & replace it with noise.

It isn’t just Twitter, it’s also because email clients are often stupid, and will wrap an address (insert line breaks) to make it fit in 72 or 80 columns, forcing people receiving the address to either fix it or just not bother.

For example:

> **[Example Domain](http://www.example.com/?foo=fram%3Bfoow245%3Bf3242eadsfc%3B3435fdsfDwqe21%3Bfdsafewr5435tafsfds%3Bft524)**

will get turned into something like:

> **[Example Domain](http://www.example.com/?foo=fram%3Bfoo)**

w245;f3242eadsfc;3435fdsfDwqe21;fds  
afewr5435tafsfds;ft524

Notice how that’s no longer a valid address. It’s easier for the recipient if it’s been shortened into something that will not be wrapped.

---

<div class="post-metadata">

**Author:** ![Nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Nobody](https://boards.straightdope.com/u/Nobody)\
**Post date:** [November 7, 2010, 8:41pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/16 "2010-11-07T20:41:48Z")

</div>

I get spam E-mails sometimes from Craigslist, and when I put my mouse over the link, it starts out http: [//bit.ly/something](https://bit.ly/something). I don’t give URL shorteners much thought, so I didn’t realize that’s what it is. Good to know.

---

<div class="post-metadata">

**Author:** ![twickster](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@twickster](https://boards.straightdope.com/u/twickster)\
**Post date:** [November 7, 2010, 10:42pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/17 "2010-11-07T22:42:53Z")

</div>

> [@jjimm](#):
>
> Strange, the ones that I’ve done under my own account are only counted for me, not for others who’ve already done the URL compression.

Hm, I haven’t set up an account there, that’s probably the difference. It would be unique if I did?

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [November 7, 2010, 10:52pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/18 "2010-11-07T22:52:10Z")

</div>

tinyurl has been around over 12 years. No telling how many url’s they’ve created. Maybe a million in that time? They claim a billion on the web site. That seems like an exaggeration.

I’ve wondered if they check and delete tiny url’s that aren’t valid any more?

---

<div class="post-metadata">

**Author:** ![tellyworth](https://avatars.discourse-cdn.com/v4/letter/t/977dab/32.png) [@tellyworth](https://boards.straightdope.com/u/tellyworth)\
**Post date:** [November 7, 2010, 11:26pm UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/19 "2010-11-07T23:26:42Z")

</div>

> [@aceplace57](#):
>
> tinyurl has been around over 12 years. No telling how many url’s they’ve created. Maybe a million in that time? They claim a billion on the web site. That seems like an exaggeration.
> 
> I’ve wondered if they check and delete tiny url’s that aren’t valid any more?

A billion probably isn’t an exaggeration. There are uncountable web sites and services that automatically generate URLs at [tinyurl.com](http://tinyurl.com) and other popular URL shorteners. Lots of web sites automatically generate short URLs for every page, for example.

Why would they delete old ones? It would cost more to figure out which ones are invalid than it would to keep them. And there’s no significant benefit in doing so.

---

<div class="post-metadata">

**Author:** ![Arnold\_Winkelried](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Arnold\_Winkelried](https://boards.straightdope.com/u/Arnold_Winkelried)\
**Post date:** [November 8, 2010, 4:58am UTC](https://boards.straightdope.com/t/how-do-url-shorteners-work/559787/20 "2010-11-08T04:58:40Z")

</div>

By the way, Google has now opened to the public their own URL shortener, with various features such as letting you know how many people have used your short URL, etc…  
It’s at [http://goo.gl](http://goo.gl)
