What Makes Up a URL? The Parts of a Web Address Explained
Learn the parts of a URL — scheme, domain, path, query string and fragment — with simple examples, common mistakes and a quick cheat sheet.
In this article
Every time you open a website, click a link or share a page, you are using a URL. Most people see it as one long line of text. But a URL is actually made of small parts, and each part has a specific job.
Once you know these parts, you can read any web address at a glance, spot suspicious links, and understand what developers mean when they talk about paths, parameters and query strings.
What Is a URL?
URL stands for Uniform Resource Locator. It is the full address of something on the internet: a web page, an image, a PDF, or an API endpoint.
In simple words: a URL tells your browser how to reach something and where to find it.
A Simple Analogy
Think of a URL like a postal address for a specific room in a building:
- The scheme is the delivery method (courier or regular post).
- The domain is the building's street address.
- The path is the floor and room number.
- The query string is a note attached to the delivery ("leave it at reception").
- The fragment is a sticky note saying "open to page 4".
The Parts of a URL
Let's break down this example:
https://shop.example.com:443/products/shoes?color=black&size=9#reviews
1. Scheme (protocol)
https:// is the scheme. It tells the browser which protocol to use. https means the connection is encrypted. Older or insecure sites use http. Other schemes you may see are mailto: for email links and ftp:// for file transfers.
2. Subdomain
shop is a subdomain. It lets one domain run several separate sections, like blog.example.com or app.example.com. The most familiar subdomain is www.
3. Domain name
example.com is the domain. It is the human-friendly name that DNS turns into the server's IP address. The last part, .com, is called the top-level domain (TLD). Others include .in, .org and .dev.
4. Port
:443 is the port. It tells the server which "door" to use. You rarely see it because browsers use port 443 for HTTPS and port 80 for HTTP by default. During development you will often see ports like localhost:3000 or localhost:8000.
5. Path
/products/shoes is the path. It points to a specific page or resource on the server, much like folders on your computer. Clean, readable paths are good for users and for SEO.
6. Query string (parameters)
?color=black&size=9 is the query string. It starts with ? and contains key=value pairs separated by &. Query strings pass extra information to the page: search terms, filters, page numbers or tracking tags like utm_source.
7. Fragment (anchor)
#reviews is the fragment. It points to a section inside the page. The browser jumps to that section, and the fragment is never sent to the server.
A Real Example You Use Every Day
When you search on a website, the search term usually goes into the query string:
https://example.com/search?q=wireless+headphones&page=2
Here q holds your search term and page tells the site which page of results to show. Change page=2 to page=3 and you get the next page.
WhatsApp chat links work the same way. A link like https://wa.me/919876543210?text=Hello opens a chat with that number and pre-fills the message from the text parameter.
URL Encoding: Why You See %20
URLs can only contain certain characters. Spaces and symbols are converted into a safe format called percent-encoding:
- A space becomes
%20(or+in query strings) &becomes%26#becomes%23
So a search for "shoes & socks" may appear as q=shoes%20%26%20socks. This is normal and keeps the URL from breaking.
URL vs URI vs Domain
These terms are often mixed up:
- Domain: just the name, like
example.com. - URL: the full address including scheme and path, like
https://example.com/about. - URI: a broader term for any identifier of a resource. Every URL is a URI, but not every URI is a URL.
In everyday conversation, "URL" and "link" mean the same thing.
How to Spot a Suspicious URL
Reading URLs properly also helps you stay safe:
- Look at the real domain, which is the part just before the first single
/. Inpaypal.com.secure-login.xyz/login, the real domain issecure-login.xyz, not PayPal. - Watch for look-alike spellings such as
amaz0n.comormicros0ft.com. - Be careful with links that use
http://on pages asking for passwords or payments. - Shortened links hide the destination. Preview them before you click when in doubt.
Common Mistakes Developers Make With URLs
- Forgetting to encode user input in query strings, which breaks links when a value contains
&or#. - Changing URLs without redirects. If you rename a page, add a 301 redirect from the old URL, or visitors and Google will hit a 404 page.
- Mixing trailing slashes, so
/aboutand/about/act as two different pages. - Putting sensitive data in query strings. URLs end up in browser history and server logs, so never put passwords or tokens there.
URL FAQ
What are the 5 main parts of a URL?
Most explanations list the scheme, domain, path, query string and fragment. Subdomains and ports are also parts of a URL, but they are often left out or hidden.
Is the "www" required?
No. www is just a subdomain. Most sites work with or without it and redirect one version to the other.
Are URLs case-sensitive?
The scheme and domain are not case-sensitive. The path and query string can be, depending on the server. To be safe, keep URLs lowercase.
What is the difference between a slug and a path?
A slug is the last readable part of a path, usually generated from a page title. In /blog/what-makes-up-a-url, the slug is what-makes-up-a-url.
Key Takeaway
A URL is not one random string. It is a set of parts: scheme, domain, port, path, query string and fragment, each telling the browser something specific about where to go and what to show.
Mini Cheat Sheet
- Scheme: how to connect (
https) - Domain: which website (
example.com) - Path: which page (
/products/shoes) - Query string: extra options (
?size=9) - Fragment: which section of the page (
#reviews)
Try it: Build a WhatsApp chat link with a pre-filled message using our free WhatsApp link generator, or turn any URL into a scannable code with the QR code generator.
Join the conversation
What do you think?
Write a comment
No comments yet. Be the first to share a thought.