Difference Between URI, URL and URN

What is a URI?

URI (Uniform Resource Identifier) is a series of characters to identify a resource. It has the following format:

scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]

Here the “scheme” is mistaken for protocols. Schemes are not protocols. Many schemes have been designed to work with protocols, yes, bu it is not true for all schemes. Scheme part tells us how the read and interpret the rest of the identifier string.

file://usr/share/doc

The example above has the scheme “file”, and there is no “file” protocol as you know. File scheme is typically used to retrieve files from within one’s own computer.

Not all parts of the URI format defined above are mandatory. Below are the optional parts of a URI:

-User information
-Port
-Query
-Fragment

What is a URL?

Uniform Resource Locator is a special type of URI. Which means URLs are actually URIs. A URL points to a resource on the web. While doing that, a URL tells us where the resource is and which mechanism to use to access it (protocol).

What is a URN?

A URN (Uniform Resource Name) is a special type of URI just like a URL. URNs define a unique resource in the context of a namespace, they don’t tell anything about the location or the access mechanism for this resource.

Below are 2 sample URIs from Wikipedia:

 

Serdar Osman Onur
I love coding web stuff, learning/applying new technologies and techniques to create things on the internet since 2004. AboutMe G+ twitter
Serdar Osman Onur

@serdarosmanonur

hard work, determination, dedication, patience, consistency, faith
"We forge our bodies in the fire of our will" - Enter the Dragon - 1973 - 3 days ago
Serdar Osman Onur