What is URI, URL and URN?

Anyone who is working on web or does some networking stuff come across abbreviations. So the question arise that whether there is any difference between these three ,Wikipedia has detailed explanation https://en.wikipedia.org/wiki/Uniform_Resource_Identifier. These three terms in some or the other way are related to some network resource.

1) Http Page which is Page https://en.wikipedia.org/wiki/Uniform_Resource_Identifier
2) Pdf hosted on a file sharing site
3) Some Network based resource

These require some uniform way locate the presence of these resources like name and discreet location of that resource.

“All URL's are URI's, but not all URI's are URL's”

URI = Uniform Resource Identifier

It is string that is used to identify a resource on network either by location or name


Name: Joe May
Address: Bay Area Singapore-87626092

In the above example to get to Joe we need to use either his name or the address or both at the same time

URL = Uniform Resource Locator

It is same as URL but it is string of characters and it refers just to the address(just the location of the resource). URL is the most used way to 
Locate resource on the web. So from the above example it will use address to locate Joe. 

URL consist of two required components

The Protocol and The Domain

Optional Components

The Path The Port Others

URN = Uniform Resource Name

So it is string which is used to locate a resource by its name in our case in above example Name will be used to locate Joe.

Lets see the further example which will elaborate the URL in parts

Protocol : Protocol is a special set of rules that end points that is used to communicate

Domain : Names are used to identify one or more IP addresses

Port :  is a way to identify a specific process to which an Internet or other network message is to be forwarded when it arrives at a server. To Specify the port a colan (:) is added after the domain name if no port number is spefied its 80 by default.

Consider the above exmaple where there are two person standing behind the wall and they want to communicate with each other. The wall has same number of door, So if a person1 wants to meet the person2 he has to open the same door. It is the same principle for the port in URL

Query String and Fragments: https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=what+is+noun

in the above link sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8  are the query parameter each seperated by ampersand (&) and the the value after each equal sign (=) corresponds to the value of the key.

Fragment : Fragment is usually at the end of the URL noted by # sign. It is use to request the portion of the page. Browser searches for the fragment tag anchor in the html code and scrolls the website down to it

To Sum Up :

We use URI, URL and URN to identify the resources.

URI’s can specify the address URL or the name URN of the resource or may be both at the same time

We usually use URL to identify the resource

A URL consist of the required components which are portocol, domain port number and optional one which are path, query parameter and fragments.

core java 12 J2EE 12


Explore Tutu'rself