Have you ever copied a URL from a website to send to someone, and it turns out to be giant? Like 10 lines long giant? It’s embarrassing and is likely to turn off your recipient from clicking the link and seeing the funny TikTok video or buying you the gift you wanted.
There’s a very easy method to make the link still work and yet shorten it up quite a bit. I learned this method because of an episode of Programming by Stealth where Bart taught us how URLs work, and broke them down into their parts.
These long URLs are created so that the website receiving them can figure out how you got to their website or how you searched. For example, they might like to know what you searched for to arrive at their site in hopes of measuring the success of their search methods.
As an example, I went to Amazon and searched for women’s winter coats, and then selected one of the coats. The URL I copied after doing this search on Amazon is 430 characters long!
In these giant URLs, you’ll find a question mark (?). This question mark is the beginning of what is called the query string. After the question mark, you’ll see some text followed by an equal sign (=) and then some more text. The text before and after the equals sign is called a name/value pair. In my coat example, I can see “keywords= winter+coats+for+women”. You can see how this information would be valuable to Amazon. That wouldn’t be too stupid to have on the copied URL, but it goes well beyond that.
After the first query string, you may see an ampersand (&) and another name/value pair separated by equal signs. These can be readable like the example I just gave, or they might be a giant pile of glop text and numbers.
Here’s the useful part of what I just explained. The entire query string can be removed from the URL and it will still work to get to the same place on the web. Be sure to remove the question mark when you cut the query string off.
After removing the query string on the giant URL for the winter coat on Amazon, the URL drops down from 430 characters to only 92:
It’s a little tricky to select the text of a URL without actually letting it navigate there but you’ll get the hang of it after a while. I would suggest testing your newly shortened URL before sending it just to make sure it still works.
I use this trick all the time and I think it increases the likelihood that my recipients will actually click my links. Hope you find it useful as well, and thanks to Bart for always teaching us something new.