How Does a URL Shortener Work?

How Does a URL Shortener Work?

A shortener can turn a long URL into a much shorter one. What magic is this?


A pair of scissors cutting the word

If you’ve used the internet, you’ve also used a URL shortener, even if you weren’t aware of it. URL shorteners provide a convenient way of sharing web addresses. But do you know how they work?

There are two main parts to URL shortening. The first involves taking an original URL and generating a shorter one. The second is the reverse process: turning a short URL back into the original one.

How Generating a Shorter URL Works

A URL shortener takes a URL and generates a shorter one, of around 10 characters. The shorter URL is unique and redirects users to the full address of the original URL automatically. But, how does the generator do this?

To generate a short URL, you begin by entering a URL on the shortener’s web page. That URL gets sent to the server, which validates it and checks for code injections and invalid parameters.

Related: Ways to Quickly Shorten URLs Straight From Your Browser

At this point, the server stores the longer URL in a database. It then generates a unique hash code and returns it in the form of a short URL. Hashing is a process that maps data of any size to a fixed-size output. This enables a shortener to guarantee the longest length of its short URLs.

What Happens When You Click on a Short URL?

The short URL acts as a key that maps to the original URL. When you try to open a short URL, your browser sends an HTTP request to the shortener server.

MAKEUSEOF VIDEO OF THE DAY

An illustration of a hand pointing to abstract text on a computer screen surrounded by icons

The service looks for this short URL in its database. If the resource exists, the web server fetches the original, longer URL and redirects to it. If it doesn’t recognize the short URL, the server will redirect to an error page typically a 404.

Related: You Can Now Shorten Form URLs in Microsoft Forms

Using a Shorter URL Is Better

Long URLs take up a lot of characters. So sharing them in resumes, emails, and microblogging sites like Twitter can be inconvenient. Shortening a lengthy URL makes the link easier to share. Advertizers often use short URLs in print material.

However, that’s not all! URL shorteners often provide extra features such as usage tracking so you can see how well your link is performing.



shorten-url
3 Ways to Quickly Shorten URLs Straight From Your Browser

In a world of microblogging and mega long links, URL shortening can be insanely useful. These tools will let you shorten URLs quickly and easily.

Read Next


About The Author

3 thoughts on “How Does a URL Shortener Work?”

  1. I do not even know how I ended up here, but I thought this post was
    good. I do not know who you are but certainly you are going to a famous blogger if
    you aren’t already 😉 Cheers!

  2. Hi there are using WordPress for your blog platform? I’m new to the
    blog world but I’m trying to get started and set up my own. Do you require any html coding knowledge
    to make your own blog? Any help would be really appreciated!

Leave a Comment

Your email address will not be published. Required fields are marked *