The URL full form which is Uniform Resource Locator, is a widely used term across the Internet to define a particular web address. However, there are other terms that can sometimes be used more appropriately when referencing an online resource. This article aims to identify these terms as well as provide examples regarding when you should use URI vs URL given the particular scenario.
Explanation of a URI
A URI, which stands for Uniform Resource Identifier, should be first understood before explaining what a URL is. According to RFC 3986,
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.
A URI can identify a web resource (e.g. an image, video, CSS file, etc) by location, name, or both. What is meant by “location” is the access mechanism used to retrieve a particular resource, for example
ftp://, etc. Additionally, “name” refers to the globally unique name of the resource. For example, given the following web address:
foobar/path/to/image.jpg section of the address refers to the name, or URN.
The following sections will explain what defines a URL or URN, however keep in mind that a URI can encompass either a URL, a URN or both.
Explanation of URL Full Form
As mentioned above, URL full form is Uniform Resource Locator, which is a subset of URIs that identify the network location of a resource. This is achieved by defining a protocol for the web resource. A URL defines where the resource can be obtained, unlike a URN which simply defines the resource’s name. To put this in terms of a real life example, a URL would correspond to a person’s street address.
When comparing a URI vs URL we can conclude that all URLs can be considered URIs, however not all URIs are considered URLs.
Explanation of a URN
A URN stands for Universal Resource Name, which is used to identify a resource by a unique name. The downfall of a URN is that it does not provide a location to retrieve a particular web resource. A URN uses a namespace and a namespace identifier to identify the resource in question. According to W3 URI Clarification, a URN namespace comes in the form of
urn:isbn:n-nn-nnnnnn-n where isbn would be the namespace identifier.
URNs can also be used to identify documents. In this case, the URN would need to be translated into a URL by a resolver where the document would be subsequently downloaded from a web server.
The following examples are all considered URIs as both URLs a URNs fall under the umbrella of URI. However, the following list contains a few examples of resources that can also be considered solely a URL or a URN.
- mailto:John.Doe@example.com (URL due to the mailto: protocol)
- http://www.ietf.org/rfc/rfc2396.txt (URL due to the http:// protocol)
- urn:ietf:rfc:2648 (URN as it does not specify a locator)
- urn:isbn:0508672084 (URN as it does not specify a locator)
When to Use the Term URI vs URL
There is a fair bit of discussion regarding when and how you should properly use the term URI vs URL. No matter how the URL is structured, it will always be technically correct if you use the term URI. This is because, as we mentioned above, a URI can identify a resource by location (URL), by name (URN), or both, therefore it is all encompassing.
However, due to the URI’s versatility, some argue that using the term “URL”, or the URL full form (Uniform Resource Locator) is a more appropriate choice when the resource contains a specific location identifier. Therefore, if the resource contains a protocol such as
ftp://, and so on, the term URL is often used as it is more specific. Alternatively, if the resource is less specific in terms of containing a location identifier, then the term URI should be used.