Skip to content

What Is a URL? Meaning, Parts and Examples

A URL (Uniform Resource Locator) is the address of a page or file on the web, like https://www.cafe.com/menu. It tells your browser how to connect, which site to ask, and which page or file to fetch from it.

What does URL stand for?

URL stands for Uniform Resource Locator. A “resource” is anything you can fetch over the internet: a web page, a photo, a PDF, a video. “Locator” is the important word. A URL doesn’t only name the thing, it says where it lives and how to get there, a bit like a postal address that also says “go by train”.

You’ll hear plenty of other names for the same thing: web address, link, link address, website address. They all mean the text that starts with something like https:// in your browser’s address bar. The term goes back to the early web. Tim Berners-Lee, who came up with the web, and two co-authors wrote the rules down as a standard in 1994, in a document called RFC 1738.

Parts of a URL

Here’s one URL with every common part filled in. Most URLs you meet only use some of these, but they always come in this order.

https://www.cafe.com:443/menu/drinks?size=large&milk=oat#hot
  1. https Scheme (protocol)
  2. www Subdomain
  3. cafe Domain name
  4. .com Top-level domain
  5. :443 Port
  6. /menu/drinks Path
  7. ?size=large&milk=oat Query string
  8. #hot Fragment
The eight parts of https://www.cafe.com:443/menu/drinks?size=large&milk=oat#hot, in the order they appear.
PartIn the exampleWhat it does
1. Scheme (protocol) https How to connect. https is a secure web page, http an old unencrypted one. It’s followed by ://.
2. Subdomain www A section of the site the owner set up. www is the classic one; shop.cafe.com or blog.cafe.com are others. Lots of sites have none.
3. Domain name cafe The name the owner registered. Together with the ending it’s what people usually mean by “the domain”: cafe.com.
4. Top-level domain (TLD) .com The ending: .com, .org, .tech, or a country like .ca. Some countries add a second level in front, like .co.uk (the TLD itself is .uk).
5. Port :443 Which “door” on the server to knock on. You almost never see it: https uses 443 and http uses 80 unless the URL says otherwise, and browsers drop :443 from an https address. You’ll meet ports on your own computer, like http://localhost:3000.
6. Path /menu/drinks Which page or file on the site, often like folders: the drinks page inside the menu section. Just / is the home page.
7. Query string ?size=large&milk=oat Extra details for the page, after a ?. Each parameter is a name=value pair, and & joins them: here size is large and milk is oat.
8. Fragment (hash) #hot A spot on the page. The browser scrolls to the element with id="hot". The fragment stays in your browser and is never sent to the server.

Together, www.cafe.com is called the host. Query strings are also where marketing links put their tracking tags, like ?utm_source=newsletter&utm_medium=email; the UTM Builder writes those for you. To pull any real address apart like this, paste it into the URL Parser.

One rare part isn’t in the diagram: a user name before the host, as in https://[email protected]/. You’ll hardly ever see one. Scammers used them to make a link look like it went to one site while it really went to the host after the @, so browsers now hide them or ask before following one.

URL examples you’ll run into

Here are a few you’ve probably clicked today.

  • https://www.youtube.com/watch?v=M7lc1UVf-VE&t=90s

    A video link. The path is /watch, and the query string carries the video’s ID in v. The t=90s parameter starts the video a minute and a half in.

  • https://www.google.com/search?q=oat+milk+latte

    A search. Whatever you type into the search box ends up in the q parameter. The + signs stand for spaces.

  • mailto:[email protected]?subject=Table%20for%20two

    An email link. A different scheme, mailto:, and no // or host: clicking it opens your email app with the address and subject filled in.

  • tel:+12025550123

    A phone number. On a phone, tapping a tel: link starts a call. Write the number with the country code and no spaces.

  • file:///C:/Users/Sam/Documents/menu.html

    A file on your own computer (on a Mac it looks like file:///Users/sam/Desktop/menu.html). It has three slashes because the host part between // and / is empty. Only you can open it, so don’t send it to anyone as a link.

In HTML the email and phone ones go in an ordinary link:

Email and phone links
<a href="mailto:[email protected]?subject=Table%20for%20two">Email us</a>
<a href="tel:+12025550123">Call (202) 555-0123</a>

The %20 in the subject is a space (more on that below). The HTML Link Generator builds links like these with the encoding done for you.

Absolute and relative URLs in HTML

In HTML, URLs go in attributes like href on links and src on images (new to tags and attributes? What is HTML? covers them). You can write a URL in full, or leave the start off and let the browser fill it in from the page you’re on.

Five ways to write a link
<a href="https://www.cafe.com/menu">Menu (absolute)</a>
<a href="menu.html">Menu (same folder)</a>
<a href="/menu">Menu (from the top of the site)</a>
<a href="../">Up one folder</a>
<a href="#top">Back to top (same page)</a>

The first is an absolute URL: it has a scheme and host, so it goes to the same place from any page. The rest are relative URLs, and where they lead depends on the address of the page they’re on. Say that page is https://www.cafe.com/menu/drinks.html:

hrefGoes toWhy
hot.html https://www.cafe.com/menu/hot.html Same folder as the page
../about.html https://www.cafe.com/about.html ../ goes up one folder
../ https://www.cafe.com/ The folder above, which here is the home page
/contact https://www.cafe.com/contact From the top of the site
?size=small https://www.cafe.com/menu/drinks.html?size=small Same page, new query string
#top https://www.cafe.com/menu/drinks.html#top Same page, jump to id="top"
//cdn.cafe.com/logo.png https://cdn.cafe.com/logo.png Same scheme, different host
https://example.com/ https://example.com/ Absolute: the page doesn’t matter

Try it: where does this link go?

Type a page address and an href. The answer comes from your browser’s own URL rules, the same ones it uses when you click a link.

Goes to

https://www.cafe.com/about.html

Relative to the folder the page is in. Each ../ goes up one folder.

Try www.cafe.com in the box. Without https:// the browser treats it as a file called “www.cafe.com” in the current folder. It’s one of the usual reasons a link to another site leads to a “page not found” on your own.

Fragment links (#coffee) are relative too: they keep the page and change only the spot. Click the links in the first box and it jumps to that section. The second box shows an absolute and a relative image src side by side:

Links that jump to a spot on the page
Absolute and relative image src

The relative image doesn’t load, and that’s on purpose. The example box isn’t a file in a folder, so mountains.svg has nothing to start from. On a real site it would load as long as the file sits in the same folder as the page. Relative URLs are the usual choice for links inside your own site, because they keep working when you move the whole site to a new domain. For other sites, always use the full URL.

URL vs URI vs URN

You’ll see URI in documentation and error messages, and it’s easy to think it’s a typo. It isn’t. URI stands for Uniform Resource Identifier, and it’s the wider family:

TermWhat it isExample
URI Any text that identifies something. Every URL and URN is a URI. https://www.cafe.com/menu, urn:isbn:0451450523
URL A URI that also says where the thing is and how to get it. https://www.cafe.com/menu
URN A URI that’s only a lasting name, with no location. You can’t open it in a browser. urn:isbn:0451450523 (a book’s ISBN)

So every URL is a URI, but not every URI is a URL. In practice the line has mostly gone away. The standard that browsers follow today, the WHATWG URL Standard, calls all of them URLs, and that’s what nearly everyone says. Some programming tools still use URI in their names (JavaScript has encodeURIComponent()), but for web addresses the two words mean the same thing.

Why some URLs have %20 in them

A URL can only use a limited set of characters. Spaces aren’t allowed, and characters like &, ? and # already have jobs. So anything else is written as a % and two hex digits. That’s called percent-encoding or URL encoding:

A file name with a space and an accent
menu card café.pdf
menu%20card%20caf%C3%A9.pdf

%20 is a space, and é takes two codes, %C3%A9, because it’s two bytes in UTF-8. Browsers often show the readable version in the address bar and send the encoded one. To encode or decode a URL yourself, use the URL Encoder & Decoder.

http and https

The s in https stands for secure. With https, everything between your browser and the website is encrypted, so someone else on the same café Wi-Fi can’t read your password or change the page on its way to you. Browsers show a padlock or a similar icon next to https addresses, and put “Not secure” next to plain http ones. One thing https doesn’t tell you is whether the site is honest. A scam site can have the padlock too; it only means nobody can listen in on the connection.

How to find a page’s URL

On a computer, click once in the address bar at the top of the browser. The whole URL gets selected, and Ctrl+C (Cmd+C on a Mac) copies it. Some browsers hide part of it until you click: Chrome leaves out https://, and Safari shows only the domain. Copying always gives you the full address.

  • For a link on a page, right-click it and choose Copy link address (Chrome), Copy link (Edge) or Copy Link (Firefox and Safari).
  • For an image, right-click it and choose Copy image address in Chrome, or Copy Image Link in Firefox.
  • On a phone, tap the address bar, or use the browser’s Share button and pick Copy. Long-press a link to get a menu with Copy link. Most apps (YouTube, Maps, shopping apps) have a Share button with a Copy link option too.

When a form asks for your “website URL”, it usually wants your home page address, like https://www.cafe.com/, with the https:// included.

Do capital letters matter in a URL?

For the start, no. The scheme and the domain don’t care about case, so these two go to the same site:

Same host, different case
HTTPS://WWW.CAFE.COM/menu
https://www.cafe.com/menu

After the domain, it’s up to the site. Many servers treat /Menu and /menu as two different pages, so a link with the wrong capital letter can end in a 404. If you build the site, keep your paths lowercase and nobody has to guess.

How long can a URL be?

The rules for URLs don’t set a maximum, and today’s browsers cope with very long ones. The other software along the way is stricter. Many web servers refuse an address longer than about 8,000 characters out of the box, some stop at less, and chat apps or older systems can cut a long link short. Internet Explorer stopped at 2,083 characters, and that’s where the common advice comes from: keep URLs under about 2,000 characters and they’ll work almost everywhere. If a URL is getting that long, the data in it usually belongs in a form sent with POST instead.

What makes a good URL

A good URL tells you what’s on the page before you click. Compare these two links to the same drink:

Hard to read, then easy to read
https://www.cafe.com/index.php?id=4821&cat=7&s=a8f3
https://www.cafe.com/menu/iced-latte
  • Use real words, and keep it short: /menu/iced-latte says it all.
  • Hyphens between words, not underscores or spaces. Google’s own advice is hyphens: iced-latte reads as two words, iced_latte may not, and a space turns into %20.
  • Lowercase everywhere, for the reason above.
  • Try not to change a URL once people link to it. If you must, send the old address on to the new one with a 301 redirect, so old links and bookmarks still work.

Questions people ask

What does URL stand for?

Uniform Resource Locator. “Resource” means anything you can fetch, like a page, an image or a PDF, and “locator” means the URL tells your browser where it is and how to get it. People also call it a web address or a link address.

What is a URL in simple words?

It’s the address of a page or file on the internet. https://www.cafe.com/menu tells the browser to connect securely (https), to the site www.cafe.com, and ask for the page at /menu. You see it in the address bar at the top of your browser.

Is a URL the same as a link?

Not quite. The URL is the address; the link is the clickable thing that points to it. In <a href="https://www.cafe.com/menu">See the menu</a>, the words “See the menu” are the link and https://www.cafe.com/menu is its URL. In everyday talk people use the two words for the same thing.

Is a URL the same as a domain name?

No. The domain name is one part of a URL. In https://www.cafe.com/menu/drinks, the domain is cafe.com; the full URL also says how to connect (https), which part of the site (www) and which page (/menu/drinks). One domain can have millions of URLs under it.

What is a website URL?

Usually it means the address of the site’s home page, like https://www.cafe.com/. Every page on the site has its own URL too, so if a form asks for your website URL, paste the home page address from your browser’s address bar, including https://.

What is the difference between a URI and a URL?

A URI (Uniform Resource Identifier) is any text that identifies something. A URL is a URI that also says where to find it, like https://www.cafe.com/menu. A URN is a URI that only names something, like urn:isbn:0451450523 for a book. So every URL is a URI, but not every URI is a URL. Browsers and most people just say URL.

Why do some URLs have %20 in them?

URLs can’t contain spaces and some other characters, so they’re written as a % and two hex digits instead. %20 is a space, %26 is &, and é becomes %C3%A9. So “menu card.pdf” turns into menu%20card.pdf. Our URL Encoder converts text either way.

Are URLs case-sensitive?

Partly. The scheme and domain aren’t: HTTPS://WWW.CAFE.COM goes to the same place as https://www.cafe.com. The path and query string can be, because that’s up to the site’s server: /Menu and /menu may be two different pages. Writing URLs in lowercase avoids the problem.

How long can a URL be?

The URL rules don’t set a maximum, and modern browsers accept very long ones. Servers and other software often stop much sooner, though; a limit of about 8,000 characters is common on web servers. Old Internet Explorer stopped at 2,083 characters, which is where the usual advice to keep URLs under about 2,000 characters comes from.

Do I need to type https:// and www?

Not in the address bar. Type cafe.com and the browser adds the scheme for you, and most sites send you on to their main address, with or without www. In HTML links it’s different: write the full URL, https:// included, or the browser reads www.cafe.com as a file in the current folder.

Keep going