Difference between URI, URL and URN

Here you will learn about difference between URI, URL and URN.

When it comes about accessing WebPages, data, files, audio, videos and other stuff, the foremost thing a programmer has to take care of is about URIs, URLs, and URNs.

So what are they? What roles do they play on the World Wide Web i.e. Internet? And how they differ?

In this tutorial we are going to find answers about these questions and understand these three terms.

URI

Uniform Resource Identifier or URI (by definition as per Wikipedia), is a string of character that is used to identify a resource.

URI is actually used to provide an address to a resource on any system, whether over Internet or on your local machine. URI start with the protocol that should be used to access the resource which is followed by the actual address of the resource and other information or constraints parameters about the resource.

URI consists of two main parts – URL and URN.

URL

Uniform Resource Locator (URL) is a subset of URI, which is the actual physical or logical address of the resource, starting with the protocol that will be used to access that resource and other parameters. URL take up a general form: protocol://host/address_to_file/key=value. Where key = value defines the parameters and constraints used.

For Example – HTML WebPages are accessed using the HTTP (Hyper Text Transfer Protocol) protocol whereas files are accessed using the FTP (File Transfer Protocol) protocol.

URN

Uniform Resource Name (URN) is an item specific property of a resource. It doesn’t provide with the protocol used to access the resource neither any address to the resource, however, it give data about the resource itself. Its unique name, encoding used to define the resource, type of resource and other details.

Example for a better understanding:

Let’s take up an example of a man, named Arjun Gupta, living in New Delhi, at 405 B Gomti Nagar.

Here

Arjun Gupta,

405 B Gomti Nagar

New Delhi, 266895

This is the URI for the man, the actual address to reach the person.

Arjun Gupta, a man – This is URN specific information about the person that will never change.

405 B Gomti Nagar, New Delhi, 266895 – This is the URL for the man that may change over time, if the resource (here, man) is moved to some other address.

This is just an example, should not be compared in reality.

Difference between URI, URL and URN

Uniform Resource Identifier Uniform Resource Locator Uniform Resource Name
Combination of URL and URN used to get access to a resource. Subset of URI. Subset of URI.
URI is the physical or logical address to the resource which also includes protocol related information with it. URL is the address of the resource with the protocol and resource specific information included. URN contains the resource specific information.
URI may change over time. URL may change over time. URN never changes for a resource.
Every URI in not URL or URN. Every URL is a URI. Every URN is a URI.

Example: 

  • URI: https://en.wikipedia.org/wiki/Main_Page
  • URL: https://en.wikipedia.org/wiki/Main_Page
  • URN: ISBN number of book, urn:isbn:0451450523

Comment below if you have queries related to difference between uri, url and urn.

4 thoughts on “Difference between URI, URL and URN”

Leave a Comment

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