February 11, 2010

Shorter is Sweeter: A Look at URL Shorteners

TechTips 254

Shorter is Sweeter: A Look at URL Shorteners

by Scott Nesbitt – February 7, 2010

PullquoteOnce upon a time, URLs (Uniform Resource Locators, which most of us know as “Web addresses” or “links”) were short and simple. Often, they looked something like http://www.geeks.com. If you had a personal Web page, your URL might look something like http://www.facebook.com/ComputerGeeks

Times change, and URLs have expanded. A lot. Just do a search at the Web site of a large corporation or your favorite online retailer. What often comes back is a long and convoluted URL. And that becomes a problem if you're into microblogging. Services like Twitter limit you to 140 characters. Some long URLs exceed that limit by quite a bit.

So, how can you tame those impossibly long URLs? With a Web-based service called a URL shortener.

How they work


As the name implies, a URL shortener shrinks a link – sometimes as much as 90%. With a couple of URL shorteners I've used, 160 character URLs were whittled down to 14 characters.

Obviously, you need to go to the site of a URL shortening service and paste a link in a field. The service checks its database to confirm whether or not that link already exists. If it does, the service gives you the short version that it assigned to the URL.

If the URL is not in the database, the service first adds it to the database. Then, the service runs the URL through a piece of software or a function called either a random alphanumeric generator or a sequential alphanumeric generator.  Those are just fancy names for a process that creates a short string of numbers and characters that the service associates with the URL – for example, http://bit.ly/7xCFKq. As you can see from the example in the last sentence, the URL of the shortening service appears in the smaller link.

Note: If your inner geek wants to know about this process in more depth, check out this article.

Clicking on a shortened link triggers a short series of events. The shortened URL points to the site of the service that originally shrunk the URL. Using the name assigned to the shortened URL, the service checks its database for the corresponding longer URL. Then, using some back-end Internet trickery called redirection, sends your browser on its way to the site in question. This all happens very quickly, and you don't really notice much (if any) of a delay.

Uses and problems

The most obvious usage is with microblogging sites like Twitter. As I mentioned at the beginning of this TechTip, some long URLs exceed the length of a tweet. A good URL shortener not only lets you add a link to a tweet, but also leaves plenty of room for a comment.

Shortened URLs are just more convenient for sharing in emails, blog posts, messages on social media sites like Facebook, or even when sending a text message from your phone. In fact, shortened URLs can appear anywhere – I saw one in an ad on the Toronto subway!

If you're sharing links with someone who uses screen reading software, a shortened URL makes is easier for the reader to process. And, obviously, it's easier for the person to type into their browser.

Of course, there can be problems with shortened URLs. Links on the Web are known to change or disappear. A shortened URL will always point to the original location. And not every URL shortening service allows its users to change URLs.

On top of that, it's not unknown for a shortened URL service to die. When a service dies, the shortened URLs created with it become useless.

Both spammers and malware writers have been known to use shortened URLs to drive traffic to less-than-savory sites. There are ways to avoid the potential problems of following such poisoned URLs. More about this in a few paragraphs.

What's out there?

There are literally hundreds of URL shortening services out there. URL shorteners come and go, but the ones discussed below are quite stable. If you want a list of all of the URL shorteners available on the Web, go here.

First up, one of the more popular and venerable services: TinyURL. This service has few frills. You enter the URL that you want to shrink into a text box at the site, and click the Make TinyURL! button. TinyURL spits back just that. You can even create your own custom URL – instead of http://www.tinyurl.com/3rE2t you can name the shortened URL http://www.tinyurl.com/mySite.

A service that's stolen a lot of TinyURL's thunder is bit.ly. That's partially because the output from bit.ly is shorter than that of TinyURL and because bit.ly also offers some interesting and useful tools. You can shorten URLs just by visiting the site. But if you get access to some useful tools if you sign up for a free account. What kinds of tools? A full list of the URLs that you've shortened. You can check how many people clicked a link in a given day. On top of that, bit.ly is now the default URL shortener for Twitter.

tr.im is a lot like bit.ly. You get the basics just by visiting the site: shrink a URL and optionally create a custom link (just like TinyURL). You can also automatically post the link to Twitter. If you sign up for a free account, you get a list of all the URLs that you've trimmed and how many times a trimmed URL has been clicked.

If you like your software a little more open and bare bones, then you might want to give ur1.ca a peek. Made by the folks behind the identi.ca microblogging service, ur1.ca only lets you shorten URLs. Not editing or deleting, or anything else. But if you're a developer you can download the source code and add the shortener to your own Web site or Web application. And you can download the entire ur1.ca database as a tab-separated file. Careful, though, it's a big database – a 25 MB archive, and growing.

Browser tools

Of course going to a Web site specifically to shorten URLs can be a bit of a pain. If you use Firefox, Google Chrome, or Opera then you can shrink URLs at the click of a button without having to visit a URL shortening site. This is done with an extension (also called an add-on or widget, depending on the browser).

Firefox has almost 30 URL shortening add-ons. The best of the lot is Shorten URL. It works with dozens of URL shortening services. All you need to do is select the URL in the browser address bar, right click it, and choose Shorten This Page URL. You can also shrink the URLs to images and to links on a Web page.

how do i get viagra title=”http://www.geeks.com/techtips/2008/techtips-05OCT08.htm”>Google Chrome has over 40 URL shortening extensions that work with a variety of services. Most of them only work with a single service, though. My favorite is  Bit.ly Shorten URL. It's very simple: go to a Web site, and click the bit.ly icon in Chrome's address bar (it's a small blowfish). You're taken to the bit.ly site, and you have your shortened URL. No muss, no fuss.

Opera only has one URL shortening widget: Simple URL. The widget only works with a service called simurl. But don't let that hold you back. You enter the URL that you want to shrink in the Simple URL widget and then click Make Link to get a 22-character URL. You can also specify an identifier for the URL, up to 10 characters long, that lets you track the URL later. Just click the My URLs tab on the widget, type the identifier in the field, and click Get My URLs. Of course, you'll have to remember your identifiers.

Earlier, I mentioned that some shortened URLs may point to unsavory sites or sites containing malware. LongURL helps you get around this by expanding a short URL and giving you information about it.

If you use Firefox, you can download an extension that will expand a short URL without having to go to the LongURL Web site.

Summing up

URL shorteners aren't for everyone. But for anyone who needs to use one, a URL shortener is an invaluable tool. It makes using microblogging services a lot easier, and makes it more convenient to share interesting links that might get broken when you copy and paste them into an email or anywhere else.

Permalink • Print • Comment

Leave a comment

You must be logged in to post a comment.

Made with WordPress and a search engine optimized WordPress theme • Sky Gold skin by Denis de Bernardy