A URL (Uniform Resource Locator) is the web address you type into a browser to reach a specific page, image, or file on the internet. It tells the browser two things: where to connect (the server) and what to ask for (the resource). You enter it in the address bar, click a link, or scan a QR code, and the browser uses it to fetch and display the content. This article explains the parts of a URL, how they work, and how to use them correctly in your own links and browser.
What Is a URL?
A URL is a standardized string of characters that identifies a resource on the web. It is a subset of the broader term URI (Uniform Resource Identifier); every URL is a URI, but not every URI is a URL. The key difference is that a URL includes the access mechanism (like http or ftp) so the browser knows how to retrieve it. For example, https://www.example.com/path/page.html is a URL because it specifies the protocol (https) and the location. A bare identifier like example.com/page is a URI but not a complete URL until you add the scheme.
The term “URL” was coined in 1994 by Tim Berners-Lee and the URI working group. It was a practical way to give every web document a unique address that could be shared and referenced. The word is standard in technical writing and everyday speech, and it is often pronounced as three letters (“you-are-ell”) or as the single word “earl.” Both pronunciations are common, and neither is incorrect.
Anatomy of a URL
Every full URL has up to five parts, though some are optional. Here is a breakdown using a typical link:
https://www.example.com:443/path/to/page?name=value#section
- Scheme (protocol):
https– tells the browser how to communicate. Common ones arehttp,https,ftp, andfile. - Host (domain):
www.example.com– the server’s address. It can be an IP address or a domain name. - Port:
:443– optional; specifies the network port. Defaults are 80 for HTTP and 443 for HTTPS, so it is usually omitted. - Path:
/path/to/page– identifies a specific resource on the server. It can be a file name, a folder structure, or a route that the server interprets. - Query string:
?name=value– starts with a question mark and contains key-value pairs separated by ampersands. It sends data to the server, often for search or filters. - Fragment:
#section– starts with a hash and points to a specific part of the page, like a heading or an anchor. It is not sent to the server; the browser uses it to scroll.
Not all URLs include every part. A home page may be just https://example.com, while a search result might be https://example.com/search?q=url+meaning.
How URLs Work in a Browser
When you type a URL and press Enter, the browser performs several steps:
- Parse the URL: It breaks the string into the scheme, host, path, etc.
- DNS lookup: It asks a DNS (Domain Name System) server to translate the domain name into an IP address, like
93.184.216.34. - Open a connection: It establishes a TCP connection to that IP address on the appropriate port (usually 443 for HTTPS).
- Send an HTTP request: It sends a request line like
GET /path/to/page HTTP/1.1along with headers that include the host name. - Receive the response: The server replies with a status code (e.g., 200 OK) and the content (HTML, images, etc.).
- Render the page: The browser processes the HTML, CSS, and JavaScript to display the page.
If the URL is missing the scheme (e.g., you type example.com), most browsers assume http:// and then often upgrade to HTTPS if the site supports it. If the host is not found, you get a DNS error.
How to Choose and Create a URL
When you create a URL for your own website or a link, follow these practical guidelines:
- Use HTTPS: It encrypts data and is now the standard for all reputable sites. Browsers mark HTTP-only pages as “Not Secure.”
- Keep it readable: Use hyphens between words (
/my-page) instead of underscores or spaces. Spaces are not allowed in URLs and get encoded as%20. - Use lowercase letters: While URLs are case-sensitive for the path, using lowercase avoids confusion and duplicate pages.
- Make it descriptive: A short, meaningful slug like
/what-is-a-urlhelps users and search engines understand the page. - Avoid special characters: Characters like
&,?, and#have special meanings. If you need them in a value, they must be percent-encoded (e.g.,&becomes%26).
When you copy a URL from a browser, it often includes tracking parameters (like ?utm_source=...). You can usually remove those parameters to get a cleaner link that still works.
Common URL Problems and Mistakes
Several issues frequently trip up users:
- Missing or wrong scheme: Typing
www.example.comwithouthttps://usually works, but if the site requires HTTPS, you may get an error or a redirect. - Typos in the domain: A single wrong letter can lead to a different site or a “server not found” error. Always double-check the spelling.
- Case-sensitive paths:
/Aboutand/aboutmay be different files on the server. Most servers are case-insensitive, but not all. - Encoded characters: Spaces are invalid; they must be written as
%20or replaced with+in query strings. Browsers often do this automatically when you paste. - Broken links: A page may have moved or been deleted. You get a 404 error. Check the URL for typos or use the site’s search.
If a URL fails, first check the scheme and domain, then the path. If you are on a page and the link is broken, try removing the query string or fragment to see if the base page loads.
URL vs. URI vs. URN
People often use “URL” and “URI” interchangeably, but they are not the same. A URI is the umbrella term for any identifier, including both URLs and URNs. A URL (Uniform Resource Locator) tells you both the name and the location, like “the file is at https://example.com/file.pdf.” A URN (Uniform Resource Name) is a persistent name that does not include a location, like urn:isbn:0451450523 for a book. In practice, most web addresses are URLs, and the term “URL” is standard in everyday language.
Another related term is “domain name,” which is just the host part of a URL. A domain name is not a URL by itself because it lacks the scheme and path. For example, example.com is a domain, while https://example.com is a URL.
URL Safety and Best Practices
URLs can be used for phishing and other scams. Here are key safety points:
- Check the domain: A link may display
example.combut actually point toexample.com.evil.com. Hover over a link before clicking to see the real destination. - Look for HTTPS: A padlock icon indicates a valid SSL certificate, but it does not guarantee the site is safe. It only means the connection is encrypted.
- Beware of misleading subdomains:
paypal.com.example.comis not PayPal. The last part before the TLD is the actual domain. - Do not enter sensitive data on suspicious URLs: If a URL looks odd, type the official address manually instead of clicking.
- URL shorteners can hide the destination: Services like bit.ly mask the real URL. Use a preview feature or a link-expander to see where they lead.
For your own links, always use HTTPS and avoid exposing sensitive data in query strings (e.g., passwords or tokens) because they can be logged in browser history and server logs.
Frequently Asked Questions
What is the difference between a URL and a link?
A URL is the address itself, while a link (or hyperlink) is the clickable text or image that points to a URL. The link contains the URL in its href attribute. When you click a link, the browser navigates to the URL.
Can a URL contain spaces?
No, spaces are not allowed in URLs. They must be percent-encoded as %20 or replaced with + in query strings. Modern browsers automatically convert spaces when you paste a URL, but it is better to avoid them entirely by using hyphens.
What does “URL encoding” mean?
URL encoding is the process of converting characters that are not allowed in URLs into a percent sign followed by two hexadecimal digits. For example, a space becomes %20, and a slash in a query value becomes %2F. It ensures the URL is correctly interpreted by the server.
Is a URL case-sensitive?
The domain part is case-insensitive, but the path and query string can be case-sensitive depending on the server. For example, /Page.html and /page.html might be different files. To avoid issues, always use lowercase for paths.
How do I find the URL of a page?
In any browser, the URL is displayed in the address bar at the top. You can click on it to select the full text, then copy it with Ctrl+C (or Command+C on Mac). On mobile, tap the address bar to see the full URL.
What is a URL shortener and is it safe?
A URL shortener takes a long URL and creates a shorter alias that redirects to the original. They are convenient for sharing on social media, but they can hide malicious destinations. Only use trusted shorteners, and be cautious when clicking shortened links from unknown sources.