Difference between URI, URL and URN

Profile picture for user devraj

Well, if you want to know if that ‘something’ is URI or URL or URN, you should always mark it as a URI because all URLs and URNs are URIs. Below are the differences:

Point of DistinctionURIURLURN
Stands ForUniform Resource IdentifierUniform Resource LocatorUniform Resource Name
Subset / SupersetAll URLs are not URI.Subset of URI. All URLs are URI.URN is also the subset of URI
Real World ExampleYour name could be a URI because it identifies you, but it couldn't be a URL because it doesn't help anyone find your location.On the other hand, your address is both a URI and a URL because it both identifies you and it provides a location for you.One of the best examples of URN is ISBN number which is used to uniquely identify a book. URN is completely different than URL as it doesn't include any protocol.
Resource The URI is the identifier of the specific resource. Like a page, or book, or a document.URL is the locator of a resource.Name of the resource
Syntax

scheme:[//authority]path[?query][#fragment]

where authority = [userinfo@]host[:port]

[protocol]://www.[domain_name]:[port 80]/[path or exaction resource location]?[query]#[fragment]

<URN> ::= "urn:" <NID> ":" <NSS>

 where <NID> is the Namespace Identifier, and <NSS> is the Namespace
   Specific String.

SchemaThe scheme can be anything – protocol, name or specification, etc...The scheme is always a protocol like HTTP, https, ftp, LDAP etc...Namespace identifier or namespace specific String.
PurposeThe main purpose of URI is to identify a resource and distinguish it from other resources using either location or nameThe main purpose is to get the address or location of a resourceUniquely identify Books and Journals
Examplecontact: +91 9999075499,
urn:isbn:1234567890
https://www.programsbuzz.com

urn:ISBN:1-23-432536-5

urn:ISSN:0167-6423

UseUsed in HTML, XML and tag library files like XSLT and jstl to identify resources and binaries.URL is used to find only web pagesFind Books and Journals or any other resource with name