keepcalculator

06 Numbers and Powers

URI vs URL: Key Differences Explained

Card No. 06·30294 · Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered
You enter
Finish time, Distance
You get
Average pace, Average speed
Rounding
2 dp

URI and URL are both identifiers for resources on the internet, but they are not the same. A URL (Uniform Resource Locator) is a specific type of URI that tells you both the name of a resource and how to get to it, while a URI (Uniform Resource Identifier) is a broader term that identifies a resource by name, location, or both. In short: every URL is a URI, but not every URI is a URL.

What Exactly Is a URI?

A URI (Uniform Resource Identifier) is a string of characters that uniquely identifies a resource. The resource can be anything: a web page, an image, a document, a person, a book, or even an abstract concept. The key word is identifies—a URI is a name or address that allows you to refer to a specific resource without ambiguity.

URIs come in two main flavors: URLs and URNs (Uniform Resource Names). A URN identifies a resource by name in a specific namespace, such as urn:isbn:0451450523 for a book. A URL identifies a resource by its location, such as https://example.com/page. Both are URIs, but they serve different purposes.

What Is a URL?

A URL (Uniform Resource Locator) is a URI that specifies where a resource is located and how to access it. It includes a scheme (like http, https, ftp), a host (like example.com), and often a path (like /page). The scheme tells you the protocol to use to retrieve the resource, and the host tells you where it lives.

For example, https://example.com/products?id=123 is a URL. It says: use HTTPS, go to example.com, and fetch the resource at /products with the query parameter id=123. Without the scheme or host, you wouldn’t know how or where to get the resource.

The Key Differences in a Nutshell

The easiest way to remember the difference is: a URL is a URI that also gives you the means to access the resource. Here are the main distinctions:

  • Scope: URI is the umbrella term; URL is a subset of URI.
  • Function: A URI identifies a resource; a URL identifies a resource and tells you how to find it.
  • Components: A URL always includes a scheme (like http) and a host. A URI may not—for example, a URN like urn:isbn:0451450523 has no scheme or host.
  • Examples: https://example.com is both a URI and a URL. urn:isbn:0451450523 is a URI but not a URL.

Why the Confusion? A Brief History

The confusion arises because the terms were coined at different times and the internet evolved quickly. Tim Berners-Lee proposed the URL in 1994 as part of the World Wide Web. Later, the broader concept of URI was standardized by the IETF in RFC 3986 (2005) to cover both URLs and URNs. Many people and even some technical documents use “URI” and “URL” interchangeably, but the formal definitions are distinct.

In practice, most URIs you encounter in web development are URLs—they point to resources that can be fetched over HTTP. But when you’re working with XML namespaces, URNs, or other identifiers, you need to understand the difference.

How to Tell If a String Is a URL or Just a URI

If you’re looking at a string and wondering whether it’s a URL or a URI, ask yourself: does it contain a scheme and a host (or a way to locate the resource)? Here’s a quick checklist:

  1. Does it start with a scheme like http, https, ftp, or mailto? If not, it’s probably not a URL.
  2. Does it have a hostname (like example.com) or an IP address? If not, it’s likely a URN or a relative URI.
  3. Can you use it to actually fetch the resource? If yes, it’s a URL. If it just names the resource without a location, it’s a URI.

For example, https://example.com is a URL. example.com alone is a URI (it identifies a resource) but not a URL because it lacks a scheme. mailto:someone@example.com is a URL because it tells you to use the mailto protocol to reach that email address.

Common Misconceptions and Mistakes

One common misconception is that a URI is always a URL. That’s false—a URN is a URI but not a URL. Another is that a URL must start with http. That’s also false—ftp://, mailto:, and file:// are all valid URL schemes.

A frequent mistake in web development is using the wrong term in documentation or code. For example, when you use the href attribute in HTML, you’re providing a URL, not just a URI. When you use the id attribute in XML, you’re providing a URI (often a URN). Mixing these up can lead to confusion, especially when dealing with namespaces or linked data.

When to Use URI vs URL in Practice

In everyday web development, you’ll almost always be dealing with URLs. When you write link, you’re using a URL. When you define an XML namespace like xmlns="http://www.w3.org/1999/xhtml", that’s a URI (and technically also a URL, but it’s used as an identifier, not a locator).

If you’re building an API or a system that needs to identify resources without necessarily fetching them, you might use URNs. For example, a book catalog might use urn:isbn:0451450523 to identify a book, which is a URI but not a URL. In contrast, if you need to link to a book on a website, you’d use a URL like https://example.com/books/0451450523.

Frequently Asked Questions

Is every URL a URI?

Yes. A URL is a specific type of URI that includes location information. Since a URI is any string that identifies a resource, and a URL identifies a resource by its location, every URL qualifies as a URI.

Is every URI a URL?

No. A URI can be a URN (a name) or a URL (a locator). For example, urn:isbn:0451450523 is a URI but not a URL because it doesn’t tell you where to find the book.

What is the difference between a URI and a URN?

A URI is the general term for any identifier. A URN (Uniform Resource Name) is a URI that uses a specific naming scheme, like urn:isbn: or urn:uuid:. URNs are meant to be persistent and location-independent, while URLs can change if the resource moves.

Can a URI be both a URL and a URN?

Technically, yes. A URI can have both a name and a location. For example, https://example.com/book could be a URL that also serves as a name for the resource. However, in practice, they are usually distinct.

Why do people use URI and URL interchangeably?

Because in most web contexts, the resources are accessed via HTTP, and the identifiers used are almost always URLs. The distinction becomes important only when dealing with URNs or when precise technical language is required, such as in standards documents.

Does the difference affect how I write code?

In most cases, no. Browsers and web servers treat URLs and URIs similarly for HTTP requests. However, when you’re working with XML, RDF, or linked data, using the correct term matters because the semantics differ. Always use “URL” when you mean a locator and “URI” when you mean any identifier.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0 | 100000
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →