URI vs URL: what is the difference?

URI( Uniform Resource Identifier) and URL( Uniform Resource Locator) are important concepts for anyone building web services or just interacting with anything using the HTTP protocol. These two concepts are often a point of confusion because they are always abbreviated.

It turns out the solution is always hidden in plain sight. When you expand the acronyms, it seems pretty clear that URI is an identifier and URL is a locator.

As posted in this wonderful Stack Overflow thread, RFC 3986 stipulates:

A URI can be further classified as a locator, a name, or both. The term “Uniform Resource Locator” (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network “location”).

One thing to note is that generally, all URLs are subsets of URIs. Not only do they identify a resource, they also provide a way to locate those resources.

For instance:

Name: Jean-Paul Mugizi

is a URI, because it identifies yours truly :)

/medium.com/@jmugizi

is a URL because it provides you a way to locate me in this endless sea of amateur note takers like me, aspiring bloggers, writers, and publishers.