Networking Basics: What’s the Difference Between URI, URL, and URN?
If you're working online or making a living doing networking, you're bound to come across acronyms — URI, URL, maybe even URN. There are times where these terms are seemingly used interchangeably.
So, is there a difference between these terms?
Well, yes. Otherwise, why would there be three different terms to describe the same thing? Describing the differences is something else entirely, but there's a simple way to look at it.
Let's Define URIs, URLs, and URNs
A URI (Uniform Resource Identifier) is a sequence of characters that identifies a logical or physical resource. There are two types of URIs: Uniform Resource Locators (URLs) and Uniform Resource Names (URNs).
All three of these are meant to refer to some network-based resource, whether that's an HTML static web page or a PDF document. These terms create a uniform way to reference the name, location, or both of that resource. To build networks of information, there needs to be a consistent way to name and find a resource. For individual resources, that's the purpose of the URI, URN, or URL.
Every URL is a URI. All URLs are URIs, but not all URIs are URLs.
The URI is a designation that serves as the most generic way to reference a network-based resource. A URI is an identifier. The URL is the location.
According to the RFC, the URL combines a name and an access method.
For instance, let's try to find a book in a library. Let's find the classic, Gone with the Wind. The title identifies the book (or resource), but how do you find it? You go to the directory computer to find the Dewey Decimal number. Since the Dewey number gives you where to locate the title, it's like the URL.
So, the URI does not tell you how to find a resource. It's a generic identifier (the book title).
The URL is the location, like the Dewey Decimal number. With URLs, there's a header and protocol prefix, that provides an access method. Different access mechanisms you might know include https://, mailto:, or ftp://. With that, we have a fully qualified path to find that resource. This entire string serves to uniquely identify the name and location of this object on the web.
There are plenty of spots you can look to further define these terms. You can go straight to the source documents that first bring them to light at theWorld Wide Web Consortium (W3C). You can also check the Request for Comments (RFC) libraries at the IETF, as well.
However, Dewey Decimal numbers are different in many libraries, so it wouldn't be considered a URN. A URN needs to be globally unique.
What is a URN?
People often describe URIs and URNs by using a name. Let's take a person's name, like Joe Smith, for example. That name can serve sort of like a URI, in that it's identifying an individual. But it doesn't tell you exactly where to find a specific Joe Smith on this globe. Or even which Joe Smith it is we're talking about.
A simple name like Joe Smith isn't a URN because it doesn't have global uniqueness. There are plenty of other Joe Smiths all over the world. A URN would be, for instance, a name with some global unique identifier attached, like a social security number or even a telephone number.
In networking, URNs are easy to spot. They're typically formed like this:
To summarize, URIs are identifiers, and this could mean either in name, location, or both. All URNs and URLs are technically also URIs, but the inverse isn't true. The part that makes something a URL is the combination of the name and a way to access it, such as https://, or mailto:.
All these bits are URIs, so saying that is always technically accurate. But if you are discussing something that's both a full URL and a URI (which all URLs are), it's best to refer to it a "URL" because it's more specific.
Knowing the difference between the three terms can be crucial to understanding a key concept behind locating anything on a device, a network, or on the world wide web.
Keith Barker has more on this terms right here: