You paste a long URL into a shortener, click a button, and get back something like thelinkspot.com/abc123. Simple enough. But what actually happens the moment someone clicks that link? The answer involves a surprisingly elegant piece of web infrastructure that most people never think about.
It all starts with a redirect
At the most fundamental level, a URL shortener is a redirect machine. When someone clicks a short link, their browser sends a request to the shortener's server. The server looks up where that short code points, then tells the browser: "don't stay here — go to this other address instead." The browser follows that instruction automatically, and the person ends up at the destination.
This happens so fast — typically in under 100 milliseconds — that most people never notice. It feels like clicking a normal link.
The two types of redirect
Not all redirects are the same. There are two types you'll encounter with URL shorteners, and they behave differently in important ways.
| Redirect type | HTTP status code | What it means | When it's used |
|---|---|---|---|
| 301 Permanent | 301 | This link has moved here permanently | Static links that will never change |
| 302 Temporary | 302 | This link is pointing here for now | Trackable links, editable destinations |
Most URL shorteners use a 302 redirect (or the similar 307). Here's why: a 301 tells browsers and search engines "cache this permanently — don't bother checking again." That means if you ever change where the short link points, many browsers will still send users to the old destination from their cache. A 302 keeps the redirect fresh, which is what you want when you need to update destinations or track clicks reliably.
The slug: your link's unique identifier
The bit at the end of a short link — like abc123 or my-shop — is called the slug. It's the key that the shortener's server uses to look up where to send you.
When you create a short link, the server either generates a random slug for you or lets you choose a custom one. That slug gets stored in a database alongside your destination URL. When someone clicks the link, the server does one database query: "what destination belongs to this slug?" Then it redirects.
For random slugs, most shorteners use a short string of letters and numbers. Six characters of base-62 encoding (A–Z, a–z, 0–9) gives you over 56 billion possible combinations — far more than any service will ever need.
What happens in the database
The database is the core of any URL shortener. Every short link is just one row in a table that looks roughly like this:
| slug | destination_url | created_at | click_count |
|---|---|---|---|
| abc123 | https://www.example.com/very/long/url | 2026-05-20 09:14:22 | 47 |
| my-shop | https://www.mystore.com/products | 2026-04-01 14:30:00 | 312 |
| xyz9 | https://docs.example.org/guide | 2026-05-18 11:45:10 | 8 |
When a click comes in, the server looks up the slug, increments the click count, and fires off the redirect. The whole thing is designed to be as fast as possible — a slow redirect would make every short link feel broken.
High-traffic shorteners go further: they store frequently-used slugs in an in-memory cache (like Redis) so that popular links can be resolved in microseconds without hitting the main database at all.
How click tracking works
Before the redirect fires, the server has a brief window to collect data about the request. This is how click tracking works.
The server can read the following from every incoming request:
- Timestamp — exactly when the click happened
- IP address — used to estimate country/region (then usually discarded for privacy)
- User-agent string — identifies the browser and operating system
- Referrer header — tells you which page the user clicked from, if any
From those four pieces of data, a shortener can show you: total clicks, clicks by country, clicks by device type (mobile vs desktop), and clicks by referrer source. All without the user installing anything or doing anything differently.
Custom domains: making it your own
Many shorteners let you use your own domain — so instead of thelinkspot.com/abc123, your links could be go.yourbrand.com/abc123. This is called a custom domain or branded short domain.
Technically, this works by pointing your domain's DNS records at the shortener's servers. When someone clicks go.yourbrand.com/abc123, the request still arrives at the same shortener infrastructure — it just arrives wearing your domain name. The server handles it identically to any other short link.
The benefit is trust: users see your brand name in the link before they click, which tends to improve click-through rates significantly.
QR codes are just short links in disguise
A QR code is nothing more than a machine-readable version of a URL. When a shortener generates a QR code for your link, it encodes the short URL (thelinkspot.com/abc123) into the QR pattern. Scanning the QR code is the same as typing the short URL — your phone opens a browser and sends a request to the shortener, which redirects you to the destination.
This is why QR codes with short links are so powerful: you can update where the QR code points just by editing the short link's destination. The QR code itself, already printed on a thousand flyers, doesn't need to change.
Read more about this in URL Shorteners and QR Codes: The Complete Guide.
Why speed matters so much
A URL shortener is in your critical path. If the shortener is slow or goes down, your links stop working. That's why the engineering focus for any serious shortener is almost entirely on speed and reliability rather than features.
Here's what that typically looks like under the hood:
| Component | Purpose | Target speed |
|---|---|---|
| DNS resolution | Find the shortener's server | < 10ms (cached) |
| TLS handshake | Secure the connection (HTTPS) | < 50ms |
| Slug lookup | Find the destination URL | < 5ms (in-memory cache) |
| 301/302 response | Tell the browser where to go | < 1ms |
| Total redirect time | ~50–100ms typical |
That's faster than a single frame of video. From the user's perspective, clicking a short link feels identical to clicking any other link.
What happens if the shortener goes down?
This is a real concern. If the URL shortener's servers go offline, every short link using that service stops working. This is why you should avoid using obscure or free services for important, long-lived links — and why picking a reliable provider matters.
For a deeper look at this, see Do Short Links Ever Expire? What Every User Needs to Know.
The difference between a shortener and a redirect
Technically, every URL shortener is a redirect service, but not every redirect service is a URL shortener. A shortener specifically focuses on producing short, shareable URLs and usually adds click tracking and management tools on top.
A basic redirect (like one you'd configure in your web server) just sends traffic from one URL to another with no tracking, no slug management, and no user interface. For more on this distinction, see URL Shortener vs Redirect: What Is the Actual Difference?
Frequently asked questions
Does the shortener see what I'm doing after I click?
No. The shortener only sees the click itself — not what you do on the destination site. Once the redirect fires and your browser loads the destination page, the shortener has no visibility. The destination site has its own analytics, but that's separate from the shortener.
Can a short link be hacked to point somewhere else?
Only if someone gains access to your account. The slug-to-URL mapping is stored in the shortener's database, and only the link owner (or someone with their credentials) can change where a link points. The link itself isn't a security vulnerability — the concern is account security, not the redirect technology.
Why do some short links take longer to load than others?
Server location matters. If the shortener's servers are on the other side of the world from the person clicking, the extra network distance adds latency. Good shorteners use CDNs or distribute their infrastructure globally to minimise this. You can learn more about what to look for in How to Choose the Right URL Shortener for Your Needs in 2026.
Do short links work forever?
Only as long as the shortener keeps the record in their database and their service stays online. Free services sometimes delete inactive links or shut down entirely. If you're using short links for anything long-lived — printed materials, published articles, product packaging — use a reliable service and consider whether the links need to last years or decades.
Simple technology, significant impact
The underlying mechanics are elegantly simple: store a slug, look it up, redirect. Everything else — tracking, custom slugs, QR codes, analytics — is built on top of that one-lookup-then-redirect foundation. The engineering challenge is making it work reliably for millions of clicks per day without ever slowing down.
Now that you know how it works, try it yourself. TheLinkSpot lets you shorten any URL for free in seconds — no account required. Paste your URL, get a short link, and see the click data come in.