One of the worst inventions in the last 10 years or so is short URLs. They are being used everywhere. On Twitter, in emails and how many times did you hear “you can find links for all these products in the description”. Just stop clicking on them. Without examing the URL first….
Why are short links bad?
1. No transparency. Should you blindly trust somebody on Twitter, or a YouTuber, or an email? HELL NO. Short URLs were useful a few years ago, when Twitter only allowed 150 characters / tweet and they’ve counted every character in a link too.
2. When you click on a short link you’re being tracked. Can you imagine if you’re the only person that’s being served a short URL?
3. Short URLs can hide malicious links.
4. Short URLs can be used alongside services that basically act like a man-in-the-middle-attack. All in the name of analytics and driving conversions and bullshit like that.
4. Short links can reveal your (approximate) address and get you hacked. Read
There’s a few ways you can unshorten a short URL. You can modify the link to get a preview of where the shortened link will take you, you can use URL checkers and you can use curl.
1. Modify the short link
We will focus on two of the most popular link shortening services. Bit.ly and tinyurl.
For bit.ly you can copy the shortened link, paste it in a new tab and add a +
at the end of the URL.
For example, https://bit.ly/3gdkv7H
becomes https://bit.ly/3gdkv7H+
For tinyurl, copy the link paste it in a new tab and add preview.
between https://
and tinyurl
.
For example, https://tinyurl.com/yxlmdqbj
becomes https://preview.tinyurl.com/yxlmdqbj
.
What about the custom short links? Custom short links, commonly used by brands, are usually built with bit.ly.
2. URL Checkers
There’s not much to say here. These are websites and/or browser extensions that allow you to paste a short URL to get the preview.
I would recommend using these type of websites/services as a last resort. And definitely don’t install a browser add-on, just use the website. Check unshorten.it or unshorten.me
3. Using curl
If you don’t know what cURL is, read the wikipedia page. Now, let’s install cURL.
- Windows – use Chocolatey and run
choco install curl
- Linux – probably cURL is already installed but if it isn’t, it should be available in the default repos.
- macOS – cURL comes installed on macOS, however it’s an old version. To update use Homebrew and run
brew install curl
But you’re not done. Because even if you’ve installed the latest version of cURL, it’s not being used by macOS. You’ll still use the default, old version that comes packed with macOS.
To use the latest version run echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc
( NOTE: replace .zshrc with .bashrc if that’s what you’re using ).
Now close and reopen the terminal or run source .zshrc/.bashrc
and if you check the cURL version, it should be the latest one available. Thanks Apple for making it harder than it should be.
Now all you have to do is run curl -sLI https://short/url | grep -i Location
. That simple.
Here’s a bonus tip, but I assume most people know this one by now. When you’re visiting a webpage that contains hyperlinks, just hover your mouse cursor of the link to get a preview of where it’ll take you. You’ll be surprised how many websites use short URLs in their hyperlinks.
Dark patterns are also something to watch out for.