I don’t know about you, but every six months or so I find myself asking what the difference is when it comes time to use one of these abbreviations — it usually comes up when I’m working on one of my plugins or working on a site for someone. No matter how many times I look it up and learn it, I always find myself looking it up again in six months time. So, I decided to put together a little article to help future me get my act together. Hopefully this helps a few others as well.
Before diving do the details of each, here’s a quick overview of these abbreviations:
- URI: Uniform Resource Identifier
Basically the general term that encompasses both URLs, you RNs, and other types of resource related abbreviations that I won’t dive into here. - URL: Uniform Resource Locator
A specific type of URI that identifies a resource along with that resources location (domain) and means (protocol) to access it. - URN: Uniform Resource Name
A specific type of URI that is concerned with uniquely (and globally) identifying a resource without specifying the resources location or a means to access it.
What is a URI (Uniform Resource Identifier)?
A URI is simply a broader term used to identify some kind of resource on the internet. It is basically a string of characters that provide a unique, general reference to that resource that both people and machines (probably AI, as it rapidly takes over the world) can use to interact with resources online.
You can think of URI as the top-level category which encompasses the more specific URL and URN sub types. Each sub type has a different function as we’ll get into next.
What is a URL (Uniform Resource Locator)?
A URL is a type of URI that goes further than just identifying a resource – a URL also specifies a means to locate and access that resource on the Internet. e.g; URLs have a protocol (https) and a domain (hookturn.io) which specify how the resource is accessed along with its location.
Some examples of URLs include:
http://example.com
This URL identifies and locates the homepage of a website with the domain name “example.com” using the HTTP protocol.
ftp://username:password@example.com/files/data.csv
This URL identifies and locates a specific file (data.csv) on an FTP server and includes the username and password needed for access.
https://192.168.1.1:8080/api/data
This URL identifies and locates a resource on a server with IP address 192.168.1.1, using the HTTPS protocol and port number 8080. Additionally, it specifies the path to the resource as `/api/data`.
What is a URN (Uniform Resource Name)?
A URN is also a type of URI but unlike a URL, it doesn’t specify a means of access or a location for the resource. You can think of a URN as a unique way to identify a resource without providing access or location information. The general syntax of a URN is as follows:
urn:<namespace identifier>:<namespace-specific string>
A common example of a URN is an ISBN (International Standard Book Number) which would look something like this:
urn:isbn:123-1-234-23456-0
Note that entering this into a browser won’t get you anywhere as it doesn’t provide a location or protocol to access the resource — it is just intended to as a universally unique ID. Regardless of where the book lives, its URN remains consistent.
The above example just demonstrates one specific type of URN but there are plenty more out there:
ISSN (International Standard Serial Number):
e.g; urn:issn:1234-5678
This URN identifies a serial publication, such as a journal or magazine, using the ISSN system.
UUID (Universally Unique Identifier):
e.g; urn:uuid:550e8400-e29b-41d4-a716-446655440000
These consist of 128-bit UUID numbers used to uniquely identify resources or entities in distributed systems.
NBN (National Bibliographic Number):
e.g; urn:nbn:au:1234-567890
The NBN is used to uniquely identify national bibliographic resources (such as publications) in a specific country. In this example, the URN identifies an Australian publication… most likely about football as that is all people seem to talk about here 😂
OID (Object Identifier):
e.g; urn:oid:1.2.3.4.5.6.7.8
OIDs are used to uniquely identify objects in a hierarchical namespace, often applied in telecommunications, healthcare, and other industries for identification purposes.
As you can see, the URN system is versatile and serves to uniquely identify resources across many domains and industries.
Can I use URL and URI interchangeably?
Yeah. Sort of.
Keep in mind that URLs are URIs but URIs aren’t necessarily URLs so it kinda depends on the context.
If you’re in a situation where you are, say, setting up an ACF field and you’re wondering whether this ACF URL field can be labelled as a URI? My answer is yes – it fits. I would advise caution, however, as you may have a real stickler for detail on your team who may notice the use of the more general term and get on your case about it. They’re everywhere…it happens.