URL vs. URI vs. URN, What’s the difference / examples

What is URI

A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opinion. A URI has two specializations known as URL and URN.

What is URN

A URI identifies a resource by name in a given namespace but not define how the resource maybe obtained. This type of URI is called

a URN. You may see URNs used in XML Schema documents to define a namespace, usually using some syntax.

And finnaly what is URL

A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://exemple.com, etc. But a URL doesn’t have to be an HTTP URL, it can be ftp://example.com, smb://example.com, etc.

Here is a diagram that shows the relationship between the three terms.

uri scheme

Here are some examples so you can understand it better.

All of these Examples are URIs:

Examples of URLs:
Examples of URNs:

Again, all of the examples above are all valid examples of URIs. You’ll note of course that all of the URNs are prefixed with “urn:”.

Hope that this was useful to you.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × 1 =