What is the difference between URI, URL and URN?

What’s the difference between an URI, URL and URN? I have read a lot of sites (even Wikipedia) but I don’t understand it.

URI: http://www.foo.com/bar.html
URL: http://www.foo.com/bar.html
URN: bar.html

Is this correct?

Difference between URI and URL [duplicate]

Possible Duplicate: What’s the difference between a URI and a URL? How are URI and URL distinguished?


Well there are lot of discussion, post, comments and questions over internet to differentiate URI, URL and URN. One answer on SO explain about it, but i am confused in implementation result in my code

Difference between URL and URI? [duplicate]

Possible Duplicate: What’s the difference between a URI and a URL? Just to get it right: URI = Tells you in which hotel you should go to sleep. URL = Tells you in which room in what hotel you should

Does urn-, url-, and uri-encoding all refer to the same thing?

Can someone clarify if URN, URI, and URL encoding are all infact the same thing? What term is most correct to use?

What’s the difference between a URI and a URL?

People talk about URLs and URIs as if they’re different things, but they look the same to the naked eye. What’s the difference between the two?

what is the difference between CONTENT_FILTER_URI and CONTENT_URI?

what are the difference between these two Contacts.CONTENT_FILTER_URI and Contacts.CONTENT_URI in android?

What is the difference between URI.escape and URI.encode in Ruby?

I’m trying to figure out the difference between between URI.escape and URI.encode in Ruby? Neither are doing what I want them to which is completely encode a url. For example I want http://my.web.com

URI/URL and String what is the difference?

This is out of curiosity, no code required, I tried using the worlds best search engine to get my answers but figured out nothing worthwhile. Whats the difference between a URI/URL and a string repre

How can a URI contain a URN as well as a URL?

Are there any examples of a URI that contains both a URN and URL? http://tools.ietf.org/html/rfc3986#section-1.1.3 A URI can be further classified as a locator, a name, or both. And which would be t

what is the difference between $_SERVER[‘REQUEST_URI’] and $_GET[‘q’]?

what is the difference between $_SERVER[‘REQUEST_URI’] and $_GET[‘q’] (which is used in Drupal)?


Uniform Resource Identifier (URI) is a string of characters used to identify a name or a resource on the Internet

A URI identifies a resource either by location, or a name, or both. A URI has two specializations known as URL and URN.

A Uniform Resource Locator (URL) is a subset of the Uniform Resource Identifier (URI) that specifies where an identified resource is available and the mechanism for retrieving it.URL defines how the resource can be obtained. It does not have to be HTTP URL (http://), a URL can also be (ftp://) or (smb://)

A Uniform Resource Name (URN) is a Uniform Resource Identifier (URI) that uses the URN scheme, and does not imply availability of the identified resource. Both URNs (names) and URLs (locators) are URIs, and a particular URI may be both a name and a locator at the same time.

The URNs are part of a larger Internet information architecture which is composed of URNs, URCs and URLs.

bar.html is not a URN. A URN is similar to a person’s name, while a URL is like a street address. The URN defines something’s identity, while the URL provides a location. Essentially, “what” vs. “where”. A URN has to be of this form <URN> ::= “urn:” <NID> “:” <NSS> where <NID> is the Namespace Identifier, and <NSS> is the Namespace Specific String.

To put it differently:

  • A URL is a URI that identifies a resource and also provides the means of locating the resource by describing the way to access it
  • A URL is a URI
  • A URI is not necessarily a URL

I’d say the only thing left to make it 100% clear would be to have an example of an URI that is not an URL. We can use the examples in the RFC3986:

URL: ftp://ftp.is.co.za/rfc/rfc1808.txt
URL: http://www.ietf.org/rfc/rfc2396.txt
URL: ldap://[2001:db8::7]/c=GB?objectClass?one
URL: mailto:[email protected]
URL: news:comp.infosystems.www.servers.unix
URL: telnet://
URN (not URL): urn:oasis:names:specification:docbook:dtd:xml:4.1.2
URN (not URL): tel:+1-816-555-1212 (?)

URI (Uniform Resource Identifier) according to Wikipedia:

a string of characters used to identify a name of a resource.

URL (Uniform Resource Locator) is a URI that implies an interaction mechanism with resource. for example http://www.google.com specifies the use of HTTP as the interaction mechanism. Not all URIs need to convey interaction-specific information.

URN (Uniform Resource Name) is a specific form of URI that has urn as it’s scheme. For more information about the general form of a URI refer to http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax

IRI (International Resource Identifier) is a revision to the definition of URI that allows us to use international characters in URIs.

Below I sum up Prateek Joshi’s awesome explanation.

The theory:

  • URI (uniform resource identifier) identifies a resource (text document, image file, etc)
  • URL (uniform resource locator) is a subset of the URIs that include a network location
  • URN (uniform resource name) is a subset of URIs that include a name within a given space, but no location

That is:

What is the difference between URI, URL and URN?

And for an example:

What is the difference between URI, URL and URN?

Also, if you haven’t already, I suggest reading Roger Pate’s answer.

URL — Uniform Resource Locator

Contains information about how to fetch a resource from its location. For example:

  • http://example.com/mypage.html
  • ftp://example.com/download.zip
  • mailto:[email protected]
  • file:///home/user/file.txt
  • http://example.com/resource?foo=bar#fragment
  • /other/link.html (A relative URL, only useful in the context of another URL)

URLs always start with a protocol (http) and usually contain information such as the network host name (example.com) and often a document path (/foo/mypage.html). URLs may have query parameters and fragment identifiers.

URN — Uniform Resource Name

Identifies a resource by name. It always starts with the prefix urn: For example:

  • urn:isbn:0451450523 to identify a book by its ISBN number.
  • urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 a globally unique identifier
  • urn:publishing:book – An XML namespace that identifies the document as a type of book.

URNs can identify ideas and concepts. They are not restricted to identifying documents. When a URN does represent a document, it can be translated into a URL by a “resolver”. The document can then be downloaded from the URL.

URI — Uniform Resource Indicator

URIs encompasses both URLs, URNs, and other ways to indicate a resource.

An example of a URI that is neither a URL nor a URN would be a data URI such as data:,Hello%20World. It is not a URL or URN because the URI contains the data. It neither names it, nor tells you how to locate it over the network.

There are also uniform resource citations (URCs) that point to meta data about a document rather than to the document itself. An example of a URC would be an indicator for viewing the source code of a web page: view-source:http://example.com/. A URC is another type of URI that is neither URL nor URN.

Frequently Asked Questions

I’ve heard that I shouldn’t say URL anymore, why?

The w3 spec for HTML says that the href of an anchor tag can contain a URI, not just a URL. You should be able to put in a URN such as <a target=”_blank” rel=”nofollow” href=”urn:isbn:0451450523″>. Your browser would then resolve that URN to a URL and download the book for you.

Do any browsers actually know how to fetch documents by URN?

Not that I know of, but modern web browser do implement the data URI scheme.

Can a URI be both a URL and a URN?

Good question. I’ve seen lots of places on the web that state this is true. I haven’t been able to find any examples of something that is both a URL and a URN. I don’t see how it is possible because a URN starts with urn: which is not a valid network protocol.

Does the difference between URL and URI have anything to do with whether it is relative or absolute?

No. Both relative and absolute URLs are URLs (and URIs.)

Does the difference between URL and URI have anything to do with whether it has query parameters?

No. Both URLs with and without query parameters are URLs (and URIs.)

Does the difference between URL and URI have anything to do with whether it has a fragment identifier?

No. Both URLs with and without fragment identifiers are URLs (and URIs.)

Is a tel: URI a URL or a URN?

For example tel:1-800-555-5555. It doesn’t start with urn: and it has a protocol for reaching a resource over a network. It must be a URL.

But doesn’t the w3C now say that URLs and URIs are the same thing?

Yes. The W3C realized that there is a ton of confusion about this. They issued a URI clarification document that says that it is now OK to use URL and URI interchangeably. It is no longer useful to strictly segment URIs into different types such as URL, URN, and URC.