Back to Blog

The Anatomy of a URL: Every Part Explained in Detail

You use fifty of them a day and most explanations still get the parts wrong. Here is the whole address, piece by piece: what the browser reads, what the server never sees, and where campaigns quietly break.

Karan Bhakuni
Karan Bhakuni
Founder, Flyn
TechnicalAug 31, 202615 min readUpdated Aug 31, 2026
The Anatomy of a URL: Every Part Explained in Detail

The Whole Address at a Glance

Every URL you have ever clicked is the same machine, arranged left to right. Take one worked example and keep it for the rest of this article:

https://www.example.com:443/guides/url?ref=nav&y=2#pricing

A URL split into seven labelled segments: the https scheme, www subdomain, example.com domain, port 443, the guides path, a ref query string and a pricing fragment
Seven segments, each with one job. Ports 80 and 443 are defaults, so browsers hide them, which is why you rarely see that fourth piece.

Reading it the way the browser does: the scheme says how to connect, the host says which machine to ask, the optional port says which door on that machine, the path says which resource, the query string carries extra data for it, and the fragment tells the browser, and only the browser, where to look once the page arrives.

Two terms worth untangling before the details. A URI is the umbrella term for any identifier; a URL is the kind that also tells you where the thing lives and how to fetch it. Every URL is a URI. In practice, and in every specification that matters for the web today, you can say URL and be understood.

Note

The diagram this article opens with exists in a hundred sloppy versions across the internet, several with misspelled labels and a query string joined with hyphens instead of equals signs. The details below follow the actual standards: RFC 3986 and the WHATWG URL specification that browsers implement.

The Scheme: How to Connect

The part before :// names the protocol. For web pages that is http or, almost always now, https, where the s means the connection is encrypted with TLS. The scheme is case-insensitive, and lowercase is the convention.

Schemes beyond the web

The scheme is also how a link opens something other than a browser tab. mailto: opens a compose window, tel: dials on a phone, sms: starts a text, and apps register their own, which is how deep links work. We maintain free generators for the common ones: mailto, tel, sms and WhatsApp, and the odd corners like otpauth: are why a generic shortener API has to be careful about what it accepts.

SchemeOpensExampleBuild one
httpsAn encrypted web pagehttps://example.comAny link, ideally via a short link
httpAn unencrypted page, now flagged by browsershttp://old.example.comAvoid publishing these
mailtoA compose window, no host partmailto:[email protected]mailto generator
telThe phone diallertel:+14155550100tel generator
smsA prefilled text messagesms:+14155550100sms generator
upi, otpauth, app schemesNative apps directlyupi://pay?pa=...the tools index

The double slash

The // after the colon marks the start of an authority, the host that follows. Schemes without a host skip it, which is why it is mailto:[email protected] and not mailto://.

Why https is not optional any more

Browsers mark plain http pages as not secure, search engines prefer encrypted pages, and modern features from geolocation to clipboard access refuse to run without it. If you connect a custom short domain, certificate provisioning should be automatic; on Flyn it is, and connecting one is a CNAME plus a TXT record.

The Host: Subdomain, Domain and TLD

Between the // and the next / lives the host, and it reads most naturally right to left, because that is the actual hierarchy.

The host go.yourbrand.com split into subdomain, domain and TLD, with a note that the host is case-insensitive while the path can be case-sensitive
The TLD is the root, the domain is what you register, and subdomains are yours to invent at no cost.

The TLD

The rightmost label, .com, .io, .dev, is the top-level domain, drawn from a fixed list. Some TLDs carry behaviour: everything under .dev and .app is preloaded as HTTPS-only in browsers, the same mechanism flyn.to uses via HSTS preload.

The domain

The label you register and pay for, yourbrand in yourbrand.com. Registering it gives you every possible subdomain and path underneath it for free, which is the economic fact the whole next section rests on.

The subdomain

Anything left of the registered domain: www, blog, go, app. Subdomains cost nothing and can point anywhere, which is exactly how branded short domains work: go.yourbrand.com is a subdomain you point at a link platform with one CNAME record. The www itself is just a convention, a subdomain like any other, and sites choose to serve with or without it.

Case, and characters beyond ASCII

The host is case-insensitive by standard: EXAMPLE.com and example.com are the same machine. Non-Latin domain names exist through Punycode, an encoding that turns international characters into an xn-- prefixed ASCII form, and because visually similar characters can spoof familiar brands, security tooling treats look-alike hosts with suspicion. It is one of the signals a link safety checker weighs.

The Port: The Door You Never See

After the host, a colon and a number select which service on the machine gets the request: example.com:8080. You almost never see one because every scheme has a default, 80 for http and 443 for https, and browsers omit defaults when displaying and when connecting.

When you will meet one

Local development, mostly: localhost:3000, localhost:8443. Occasionally an internal tool or a legacy system on a nonstandard port. If a public marketing URL carries a visible port, something is misconfigured, and it will look broken to users even when it works.

One practical implication

A URL with an explicit non-default port is a different origin from the same URL without it, which matters for cookies and security boundaries. It also tends to trip corporate firewalls, one more reason public links should never need one.

The Path: Where Slugs Live

From the first / after the host up to any ? or #, the path names the resource: /guides/url. It looks like a folder structure and served static sites really did map it to folders; modern applications treat it as a routing pattern, which is why /blog/anatomy-of-a-url works without any folder existing anywhere.

Paths can be case-sensitive

This is the asymmetry that catches people: the host is case-insensitive, the path is whatever the server says it is. On most Linux-served sites /Page and /page are different resources, and one of them is a 404. Lowercase everything and the problem never exists.

The slug

The final human-readable segment, anatomy-of-a-url here, is the slug. Good slugs are short, lowercase, hyphen-separated, and free of dates that make content look stale in two years. Our slug generator applies those rules to any title, and on a short link the slug is the entire path: flyn.to/spring-sale is host plus slug and nothing else, which is the whole trick of a short link.

Trailing slashes

/guides and /guides/ can be treated as the same page or as two pages, and if a site serves both without redirecting one to the other, search engines see duplicates. A canonical URL checker shows which version a page declares as the real one, and a redirect checker shows whether the other is properly forwarded.

The Query String: Where Tracking Lives

Everything between ? and the end of the URL, or the # if there is one, is the query string: data for the page, written as key=value pairs joined by &.

A query string broken into chips showing the question mark starting the query, utm parameters as key=value pairs, and ampersands separating the pairs, with three rules about order, encoding and case
The ? starts it, = binds each key to its value, and & separates pairs. Every campaign parameter you have ever seen follows this shape.

What actually rides in there

Search terms, filters, pagination, session state, and above all marketing attribution. The five utm_ parameters your analytics reads are ordinary query parameters with agreed names, nothing more. Our UTM guide covers the naming discipline; the UTM builder assembles them without typos, and the UTM parser decomposes a URL you have been handed.

The three rules from the figure, expanded

Order is not meaningful to the server, a=1&b=2 and b=2&a=1 ask for the same thing, but caches, analytics grouping and reporting can treat them as different URLs, so keep a consistent order when you generate links programmatically.

A raw ampersand inside a value truncates the rest. If a destination URL or a product name containing & goes into a parameter unencoded, everything after it becomes a new, meaningless key. This is the single most common way redirects drop campaign parameters.

Keys are case-sensitive. utm_source and UTM_Source land in different columns of your analytics, permanently splitting one campaign into two rows.

A shortener has two relationships with query strings: parameters baked into the destination survive the redirect, while parameters a visitor appends to the short link itself may or may not be forwarded, and most platforms, Flyn included, drop appended parameters on redirect. Bake attribution into the destination at creation time and the question never arises.

The Fragment: The Part the Server Never Sees

Everything after # is the fragment, and it has the strangest property in the whole address: the browser never sends it. It is not stripped by servers or lost in transit; it is excluded from the HTTP request by design.

Two panels showing the browser holding a URL with an install fragment while the server receives only the path and query, with notes on why server logs never see fragments
The request on the wire carries the path and query only. The fragment is a private note from the URL to the browser.

What it is for

Classically, jumping to an anchor: #pricing scrolls to the element with that id, which is how every table of contents on this blog works, including the one on our comparison posts. Modern browsers extend it with text fragments, #:~:text=some%20phrase, which scroll to and highlight a phrase even where no anchor exists.

What follows from "never sent"

Server logs cannot record fragments, so a link tagged only with #campaign is invisible to any server-side analytics. Redirects cannot read them either; browsers reattach the fragment to wherever the redirect lands, which usually works and occasionally surprises. And early single-page applications routed with #/inbox style paths precisely because changing a fragment never triggers a server round trip.

Watch out

If you need attribution, it belongs in the query string, not the fragment. A #source=newsletter tag reaches no server, no log and no analytics tool that measures at the redirect, ours included. This is the most consequential fact in this article for anyone measuring clicks.

Percent-Encoding: The Escape Hatch

Every character in a URL is either doing a job or is plain data, and the characters with jobs, ?, &, =, #, / and their colleagues, cannot appear as plain data without being escaped. The escape mechanism is percent-encoding: the byte's hex value after a %.

A table mapping raw characters to their percent-encoded forms: space to %20, ampersand to %26, question mark to %3F, hash to %23, equals to %3D, and non-ASCII characters to UTF-8 byte sequences
Spaces become %20, and every reserved character has a code. Encode values, never the separators doing their jobs.

The rules that matter

A space is %20 anywhere, and historically + inside query strings only, a convention from HTML forms that still trips parsers when used elsewhere. Non-ASCII text, accented characters, other scripts, emoji, is encoded as its UTF-8 bytes, so ü becomes %C3%BC, which is why international URLs look alarming in their raw form while displaying beautifully in the address bar.

Encode values, not URLs

The classic mistake is encoding an entire URL, turning the separators into data and producing an address that no longer parses. The correct discipline is to encode each value before assembling, which is what encodeURIComponent does in JavaScript and what any competent link builder, ours included, does for you. Our URL encoder and decoder handles both directions when you are debugging by hand.

Double-encoding, the sequel

Encoding an already-encoded value turns %20 into %2520, and the page receives a literal %20 as text. If you see %25 in a URL, something in the chain encoded twice. Decode with the same tool to see what the value has actually become.

Frequently Asked Questions

What are the parts of a URL called?
Up to seven, in order: the scheme (https), which says how to connect; an optional subdomain (www or go); the domain you register (example.com, ending in a TLD like .com); an optional port (443, hidden when it is the default); the path (/guides/url), whose last human-readable segment is the slug; the query string (?key=value&other=value), which carries data such as UTM parameters; and the fragment (#section), which positions the browser within the page. Only the scheme and host are required for a working web URL; everything after the host is optional.
What is the difference between a URL and a URI?
A URI is the umbrella term for any string that identifies a resource. A URL is the subset that also locates it, telling you where it lives and how to fetch it, which every web address does. So every URL is a URI, but an identifier like a book's ISBN URN is a URI that is not a URL. In day-to-day web work the distinction changes nothing: the browser specification that governs how addresses are parsed is literally called the URL Standard, and calling a web address a URL is always correct.
Is a URL case-sensitive?
Parts of it. The scheme and the host are case-insensitive by standard, so HTTPS://EXAMPLE.COM and https://example.com reach the same server. The path is whatever the server decides, and on most Linux-hosted sites /Page and /page are different resources, so one of them is usually a 404. Query string keys are case-sensitive too: utm_source and UTM_Source land as different parameters in analytics, silently splitting one campaign into two reporting rows. The safe convention is to lowercase everything you publish, which makes the question moot.
What is a query string in a URL?
Everything after the question mark: data for the page, written as key=value pairs joined by ampersands, such as ?utm_source=newsletter&utm_medium=email. The server and the page's scripts can read it, which is why search terms, filters and campaign attribution all travel there. Three details cause most real-world breakage: pair order does not matter to the server but can matter to caches and analytics grouping; an unencoded ampersand inside a value truncates every pair after it; and keys are case-sensitive. UTM parameters are ordinary query parameters with standardised names.
Why is the fragment not sent to the server?
By design: the HTTP request line carries the path and query string only, and everything after the hash stays in the browser. The fragment's job is client-side positioning, scrolling to an anchor id, highlighting a text fragment, or driving single-page-app routing, none of which needs a server round trip. The practical consequence is that no server log, redirect or server-side analytics tool can ever see a fragment, so attribution tagged as #source=newsletter measures nothing. Anything you need measured belongs in the query string instead.
What is percent-encoding and why does %20 appear in URLs?
Characters like ?, &, = and # have structural jobs in a URL, so using one as plain text requires escaping it as a percent sign followed by the byte's hex value: a space becomes %20, an ampersand %26, a hash %23. Non-ASCII text is encoded as its UTF-8 bytes, so ü becomes %C3%BC. The two classic mistakes are encoding a whole URL, which destroys the separators doing their jobs, and double-encoding, which turns %20 into %2520 and delivers literal percent signs to the page. Encode individual values before assembling, never the finished address.
What is the maximum length of a URL?
No formal limit exists in the standards, but practical ceilings do. The long-standing safe figure is around 2,000 characters, inherited from old Internet Explorer's 2,083 limit and still echoed by sitemap specifications, CDNs and some servers that reject longer requests. Modern browsers handle far more, but every intermediary in the chain gets a veto. Affiliate and campaign URLs bump into these ceilings surprisingly often, which is one practical reason to shorten: a short link keeps the shareable address tiny while the full-length destination lives server-side.
How do short links relate to URL structure?
A short link is the same anatomy stripped to three parts: scheme, host and a slug as the entire path, with no query string or fragment. The full destination, campaign parameters included, is stored by the platform and restored during the redirect, usually a 301 or 302 answered in milliseconds. Two structural details matter when you use one: parameters baked into the destination survive the redirect, while parameters appended to the short link itself are dropped by most platforms; and a fragment on the short link is reattached by the browser after the redirect rather than passing through any server.

Ready to try Flyn?

Free plan includes 25 links/month, full analytics, and access to all 30+ free tools above. No credit card required.

Already a member? Log in

Karan Bhakuni
Karan Bhakuni· Founder, Flyn

Karan Bhakuni is the founder of Flyn. He writes about branded links, click analytics, and the link-management tooling growth teams and creators actually need, drawn from building Flyn and reading a lot of user feedback.

Find these guides useful? Add Flyn as a preferred source so more of them show up in your Google results.