Create Shorter URLs

Shortening a long Amazon URL is just a matter of knowing where to put the ASIN.

If you’ve ever tried to send a link to an Amazon product detail page to your friends via email, you know what a hassle those long Amazon URLs can be. Most email programs wrap the text at 72 characters and end up breaking the URL, often making it unusable. Next time, instead of copying and pasting the URL exactly as you see it, try cropping it a bit so the lines won’t wrap. Here’s what a URL copied directly from Amazon looks like:

http://www.amazon.com/exec/obidos/ASIN/0596004478/qid%3D1049157816/[RETURN]
sr%3D11-1/ref%3Dsr%5F11%5F1/104-2773718-4336742

For those of you keeping score at home, that’s 114 characters! The core piece we’re looking to dig out and preserve, the ASIN [Hack #1], is the only bit really needed to target the right product page. Everything after the 10-digit ASIN is garbage—session tracking and other bits and bobs used by Amazon—when we just want to link to the page. So we can instantly make a shorter link by removing the excess baggage:

http://www.amazon.com/exec/obidos/ASIN/0596004478/

That’s much better. We’re down to 50 characters, well within the non-wrap zone of most email clients. But if you really want to push the character-limit envelope, there’s a little-known way (contributed by Cyrus Durgin at Amazon) to shorten the URL even further. You can replace exec/obidos simply with o, as in:

http://amazon.com/o/ASIN/0596004478

That brings us down to 35 characters. (OK, so maybe taking out the www. was cheating, but 39 is still impressive.) Now the URL is suitable for email, instant messages, or even writing out long-hand!

Get Amazon Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.