URI vs. URL: What’s the Difference?

Updated (1/18/2011) : Because there’s still a lot of confusion, I’ve created a third post that attempts to resolve a lot of the questions from the comments on the last two posts. The new post is here.

Updated (8/27/2009): I’ve created another post that attempts to make the distinctions a bit more clear. The new post is here.

What is the difference between a URL and URI and why does it matter? This topic is confusing to some (myself included) and I thought I’d share my understanding of the two concepts. I’m hoping this post will give you a better understanding about how the two differ and why it matters to some.

Note: The goal of this post is to simplify the distinction between URI and URI. If you feel that in the summarization process something was lost, or it’s simply just correct, please post a comment and the information will be corrected. I only ask for any comments/criticism to be constructive.

Update: Thanks some constructive, and not-so constructive, feedback from some readers I have updated this post to correct many of my own misunderstandings. Of which, there were many.

URI

A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opionion. A URI has two specializations known as URL and URN.

URN

A URI identifies a resource by name in a given namespace but not define how the resource maybe obtained. This type of URI is called a URN. You may see URNs used in XML Schema documents to define a namespace, usually using a syntax such as:

<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="urn:example"

Here the targetNamespace use a URN. It defines an identifier to the namespace, but it does not define a location.

URL

A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://damnhandy.com, etc. But a URL doesn’t have to be an HTTP URL, it can be ftp://damnhandy.com, smb://damnhandy.com, etc.

The Difference Between Them

So what is the difference between URI and URL? It’s not as clear cut as I would like, but here’s my stab at it:

A URI is an identifier for some resource, but a URL gives you specific information as to obtain that resource. A URI is a URL and as one commenter pointed out, it is now considered incorrect to use URL when describing applications. Generally, if the URL describes both the location and name of a resource, the term to use is URI. Since this is generally the case most of us encounter everyday, URI is the correct term.

72 thoughts on “URI vs. URL: What’s the Difference?

  1. @Giacomo Masetti
    “http://www.domain.tld/somepath/file.php?mykey=somevalue” is a URI. It’s also a URL because it identifies a resource by its location. “http://www.domain.tld/somepath/file.php” is also a URL and a URI. The difference between the two URIs is that the second lacks a query string.

    Like

  2. Classically, URIs were grouped into two subclasses: a location (URL) or a name (URN). Each scheme was put into one of these subclasses; http into the URL subclass, isbn into the URN subclass.

    However, this has changed so that a URN is a URI that has the “urn” scheme, and a URL is an abstract term that describes a URI that identifies a resource by its location. Therefore, URLs and URNs are both URIs.

    There’s nothing wrong with using the term URL so long as you know that URL and URI are not interchangeable.

    Like

  3. Classically, URIs were grouped into two subclasses: a location (URL) or a name (URN). Each scheme was put into one of these subclasses; http into the URL subclass, isbn into the URN subclass.

    However, this has changed so that a URN is a URI that has the “urn” scheme, and a URL is an abstract term that describes a URI that identifies a resource by its location. Therefore, URLs and URNs are both URIs.

    There’s nothing wrong with using the term URL so long as you know that URL and URI are not interchangeable.

    Like

  4. Pingback: Reality Me » URL Shorteners Causing a Stir

  5. Best solution –

    Jon Davis Says:

    November 26th, 2007 at 4:49 pm
    Marcus, URL is NOT deprecated. That’s like saying “XHTML is deprecated and we should now refer to it as XML”. “URI” has been around for as long as I can remember (I’ve been in this for at least a decade, even submitted a few IETF proposals and got shot down because my proposals “were not URI-compliant”), URI has never tried to replace “URL”, which is a [locator] subset of URI [identifier].

    In practice, you shouldn’t call it “URI” if you’re just referring to an or . You should call it “URI” if you’re referring to a schema namespace identifier or, in some cases, a versioned Javscript library. I set up a web resource specifically for that purpose at cachefile.net.

    Like

  6. Best solution –

    Jon Davis Says:

    November 26th, 2007 at 4:49 pm
    Marcus, URL is NOT deprecated. That’s like saying “XHTML is deprecated and we should now refer to it as XML”. “URI” has been around for as long as I can remember (I’ve been in this for at least a decade, even submitted a few IETF proposals and got shot down because my proposals “were not URI-compliant”), URI has never tried to replace “URL”, which is a [locator] subset of URI [identifier].

    In practice, you shouldn’t call it “URI” if you’re just referring to an or . You should call it “URI” if you’re referring to a schema namespace identifier or, in some cases, a versioned Javscript library. I set up a web resource specifically for that purpose at cachefile.net.

    Like

  7. “it seems is if the concept of URI is a refinement of URL”

    Hm, it seems the opposite. A URL contains everything a URI does, but extends it with location and access info.

    Like

  8. “it seems is if the concept of URI is a refinement of URL”

    Hm, it seems the opposite. A URL contains everything a URI does, but extends it with location and access info.

    Like

  9. All URLs are URIs then, and it seems is if the concept of URI is a refinement of URL, to cater for the increased range of resources that are being made available via the internet, So, simple question –
    “As a plain user, doesn’t program (doesn’t want to program) but just likes to understand things; would I ever need to know the difference between URL and URI?”

    Like

  10. All URLs are URIs then, and it seems is if the concept of URI is a refinement of URL, to cater for the increased range of resources that are being made available via the internet, So, simple question –
    “As a plain user, doesn’t program (doesn’t want to program) but just likes to understand things; would I ever need to know the difference between URL and URI?”

    Like

  11. Actually, the W3C is wrong to have deprecated the term URL. The distinction matters. Also a URN is most definitely a URI.

    A URL: The house at 123 Some Street Anytown, CA 12345, by invitation only
    A URN: John’s house.

    We could define something called a URA, uniform resource accessor, but we already have a name for them: Protocol. Since we only use one standard for defining and searching namespaces, the protocol for a namespace is implied and never mentioned. Instead we include the containing namespace. On the other hand there are many methods for accessing information so to acquire a document one has to include the protocol.

    Some might argue that protocols and namespaces are both URAs.

    Like

  12. Actually, the W3C is wrong to have deprecated the term URL. The distinction matters. Also a URN is most definitely a URI.

    A URL: The house at 123 Some Street Anytown, CA 12345, by invitation only
    A URN: John’s house.

    We could define something called a URA, uniform resource accessor, but we already have a name for them: Protocol. Since we only use one standard for defining and searching namespaces, the protocol for a namespace is implied and never mentioned. Instead we include the containing namespace. On the other hand there are many methods for accessing information so to acquire a document one has to include the protocol.

    Some might argue that protocols and namespaces are both URAs.

    Like

  13. I guess the W3C has deprecated the term ‘URL’. I have not actually read that on their site, but I have heard it enough times from other people to believe it.

    If you want to use the term ‘URI’ instead of ‘URL’, that’s fine, but in order to make it technically correct (which is what this seems to be all about) the meaning of the ‘URI’ needs to be changed so that a URN is not a URI.

    Otherwise, to take an example from Thiwanka, if a form asks you for a URI and you enter ‘urn:isbn:0-395-36341-1’, you’re technically correct, but the form is gonna fall on it’s face trying to understand it.

    I think the W3C is wrong here, and I will continue to use URL when I want a URL, URN when I want a URN, and URI when I want either one.

    Like

  14. I guess the W3C has deprecated the term ‘URL’. I have not actually read that on their site, but I have heard it enough times from other people to believe it.

    If you want to use the term ‘URI’ instead of ‘URL’, that’s fine, but in order to make it technically correct (which is what this seems to be all about) the meaning of the ‘URI’ needs to be changed so that a URN is not a URI.

    Otherwise, to take an example from Thiwanka, if a form asks you for a URI and you enter ‘urn:isbn:0-395-36341-1’, you’re technically correct, but the form is gonna fall on it’s face trying to understand it.

    I think the W3C is wrong here, and I will continue to use URL when I want a URL, URN when I want a URN, and URI when I want either one.

    Like

  15. If two examples were given one for URI and one for URL, and just tell how they differe, it would be much more helpful, and much more concise than what is given here. Honestly, I couldn’t understand much other than “a uri is a url” … (or is it the other way round? :-))

    Like

  16. If two examples were given one for URI and one for URL, and just tell how they differe, it would be much more helpful, and much more concise than what is given here. Honestly, I couldn’t understand much other than “a uri is a url” … (or is it the other way round? :-))

    Like

  17. To my understanding;

    A Uniform Resource Indicator identifies a resource (e.g. HTML page)

    A Uniform Resource Locator specifies how to access the resource (e.g via HTTP)

    Like

  18. To my understanding;

    A Uniform Resource Indicator identifies a resource (e.g. HTML page)

    A Uniform Resource Locator specifies how to access the resource (e.g via HTTP)

    Like

  19. Blog is Correct.
    Uniform Resource Identifier (URI), is a compact string of characters used to identify or name a resource. The main purpose of this identification is to enable interaction with representations of the resource over a network, typically the World Wide Web, using specific protocols. URIs are defined in schemes defining a specific syntax and associated protocols.

    URI can be classified as a locator or a name or both. A Uniform Resource Locator (URL) is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network “location”. For example, the URL http://www.wikipedia.org/ is a URI that identifies a resource (Wikipedia’s home page) and implies that a representation of that resource (such as the home page’s current HTML code, as encoded characters) is obtainable via HTTP from a network host named http://www.wikipedia.org. A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. A URN can be used to talk about a resource without implying its location or how to dereference it. For example, the URN urn:isbn:0-395-36341-1 is a URI that, like an International Standard Book Number (ISBN), allows one to talk about a book, but doesn’t suggest where and how to obtain an actual copy of it.

    Like

  20. Blog is Correct.
    Uniform Resource Identifier (URI), is a compact string of characters used to identify or name a resource. The main purpose of this identification is to enable interaction with representations of the resource over a network, typically the World Wide Web, using specific protocols. URIs are defined in schemes defining a specific syntax and associated protocols.

    URI can be classified as a locator or a name or both. A Uniform Resource Locator (URL) is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network “location”. For example, the URL http://www.wikipedia.org/ is a URI that identifies a resource (Wikipedia’s home page) and implies that a representation of that resource (such as the home page’s current HTML code, as encoded characters) is obtainable via HTTP from a network host named http://www.wikipedia.org. A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. A URN can be used to talk about a resource without implying its location or how to dereference it. For example, the URN urn:isbn:0-395-36341-1 is a URI that, like an International Standard Book Number (ISBN), allows one to talk about a book, but doesn’t suggest where and how to obtain an actual copy of it.

    Like

  21. Pingback: SiNi Daily » Blog Archive » URI vs. URL: What’s the difference?

  22. Pingback: Unterschied zwischen URL und URI » Word Up!

  23. Pingback: Mobile Hippie | links for 2007-11-27

  24. eww. my comment got truncated and turned blood-red.

    ehh, you shouldn’t call it “URI” if you’re just referring to an [img src=”..”] or [a href=”..”]. That’s a URL. You should call it “URI” if you’re referring to a schema namespace identifier, or, in some cases, a versioned Javscript library in [script src=”..”. I set up a web site specifically for that purpose at cachefile.net.

    Like

  25. eww. my comment got truncated and turned blood-red.

    ehh, you shouldn’t call it “URI” if you’re just referring to an [img src=”..”] or [a href=”..”]. That’s a URL. You should call it “URI” if you’re referring to a schema namespace identifier, or, in some cases, a versioned Javscript library in [script src=”..”. I set up a web site specifically for that purpose at cachefile.net.

    Like

  26. Marcus, URL is NOT deprecated. That’s like saying “XHTML is deprecated and we should now refer to it as XML”. “URI” has been around for as long as I can remember (I’ve been in this for at least a decade, even submitted a few IETF proposals and got shot down because my proposals “were not URI-compliant”), URI has never tried to replace “URL”, which is a [locator] subset of URI [identifier].

    In practice, you shouldn’t call it “URI” if you’re just referring to an or . You should call it “URI” if you’re referring to a schema namespace identifier or, in some cases, a versioned Javscript library. I set up a web resource specifically for that purpose at cachefile.net.

    Like

  27. Marcus, URL is NOT deprecated. That’s like saying “XHTML is deprecated and we should now refer to it as XML”. “URI” has been around for as long as I can remember (I’ve been in this for at least a decade, even submitted a few IETF proposals and got shot down because my proposals “were not URI-compliant”), URI has never tried to replace “URL”, which is a [locator] subset of URI [identifier].

    In practice, you shouldn’t call it “URI” if you’re just referring to an or . You should call it “URI” if you’re referring to a schema namespace identifier or, in some cases, a versioned Javscript library. I set up a web resource specifically for that purpose at cachefile.net.

    Like

  28. Pingback: User First Web » links for 2007-11-26

  29. Nice, Ryan. I’m glad that for once in my life I ratcheted down my emotion in a blog comment to a useful level, heh. Wish I could say that more often 😉

    Like

  30. Nice, Ryan. I’m glad that for once in my life I ratcheted down my emotion in a blog comment to a useful level, heh. Wish I could say that more often 😉

    Like

  31. Pingback: DamnHandy : » URI vs. URL Post Corrected

  32. Actually Marcus, your comments where very helpful and constructive. After taking a deeper look at things, your comments were spot on and I have updated this post to more accurately reflect the correct differences. In fact, this was the type of feedback I was looking for, so thanks for taking the time to post your feedback!

    Ryan-

    Like

  33. Actually Marcus, your comments where very helpful and constructive. After taking a deeper look at things, your comments were spot on and I have updated this post to more accurately reflect the correct differences. In fact, this was the type of feedback I was looking for, so thanks for taking the time to post your feedback!

    Ryan-

    Like

  34. I’ve always believed the URL referred to the full web address including hostname, and/or path, and/or file. The URI on the other hand would cover all the relative use cases inside an html page, where further links are referenced with no hostname and just path and/or file.

    Whatever my understanding was, if URL is deprecated now thats fine with me. Inconsistencies like this one aren’t entirely helpful though towards moving users to new web standard proposals. Another small example is validators that go ballistic looking for doctype, and complaining about tags being in uppercase when actually thats how the original standards suggested coding pages.

    Like

  35. I’ve always believed the URL referred to the full web address including hostname, and/or path, and/or file. The URI on the other hand would cover all the relative use cases inside an html page, where further links are referenced with no hostname and just path and/or file.

    Whatever my understanding was, if URL is deprecated now thats fine with me. Inconsistencies like this one aren’t entirely helpful though towards moving users to new web standard proposals. Another small example is validators that go ballistic looking for doctype, and complaining about tags being in uppercase when actually thats how the original standards suggested coding pages.

    Like

  36. Pingback: Javascript News » Blog Archive » URI vs. URL: What’s the difference?

  37. What a complete load of nonsense. The file extension is utterly meaningless. It contains NO information used by the HTML client for anything. It is a convenience for human operators reading URIs not machines.

    A Universal Resource Locator is a kind of Uniform Resource Identifiers. A URI is part of TCP/IP, a URL is the URI type specific to HTTP.

    Like

  38. What a complete load of nonsense. The file extension is utterly meaningless. It contains NO information used by the HTML client for anything. It is a convenience for human operators reading URIs not machines.

    A Universal Resource Locator is a kind of Uniform Resource Identifiers. A URI is part of TCP/IP, a URL is the URI type specific to HTTP.

    Like

  39. I’m not sure if you’ll find it constructive to say this, but this post is quite misleading. The first time I saw it I just ignored it, but since someone else linked to you, I have to say that a URL is a deprecated term for a URI that includes the network location and scheme. A URI is much more flexible.

    So to break it down:

    1. URI vs URL doesn’t have anything to do with extensions representing mime types nor content negotiation

    2. It’s never preferred to use the term URL in a modern technical application because the term is deprecated, it is only appropriate in colloquial use, where “URL” still rules

    3. Content negotiation lives within the world of HTTP (in the context of your article), addressing lives within the world of URIs, the HTTP scheme happens to use URI’s “generic syntax” for resource identifiers. This is not a HTTP-specific syntax by any means

    4. A URL with or without an extension would be just as right either way, it lives in a different world from HTTP content negotiation

    I guess the really important thing is that it’s just not appropriate to use the term URL in a modern technical context at all. The term has no meaning or importance technically, only culturally. One could argue that in a colloquial sense, URI and URL mean exactly the same thing.

    To read Tim Berners-Lee on the topic:

    “A URI can be further classified as a locator, a name, or both. The term “Uniform Resource Locator” (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network “location”).”

    From Uniform Resource Identifier (URI): Generic Syntax, http://gbiv.com/protocols/uri/rfc/rfc3986.html#URLvsURN)

    Like

  40. I’m not sure if you’ll find it constructive to say this, but this post is quite misleading. The first time I saw it I just ignored it, but since someone else linked to you, I have to say that a URL is a deprecated term for a URI that includes the network location and scheme. A URI is much more flexible.

    So to break it down:

    1. URI vs URL doesn’t have anything to do with extensions representing mime types nor content negotiation

    2. It’s never preferred to use the term URL in a modern technical application because the term is deprecated, it is only appropriate in colloquial use, where “URL” still rules

    3. Content negotiation lives within the world of HTTP (in the context of your article), addressing lives within the world of URIs, the HTTP scheme happens to use URI’s “generic syntax” for resource identifiers. This is not a HTTP-specific syntax by any means

    4. A URL with or without an extension would be just as right either way, it lives in a different world from HTTP content negotiation

    I guess the really important thing is that it’s just not appropriate to use the term URL in a modern technical context at all. The term has no meaning or importance technically, only culturally. One could argue that in a colloquial sense, URI and URL mean exactly the same thing.

    To read Tim Berners-Lee on the topic:

    “A URI can be further classified as a locator, a name, or both. The term “Uniform Resource Locator” (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network “location”).”

    From Uniform Resource Identifier (URI): Generic Syntax, http://gbiv.com/protocols/uri/rfc/rfc3986.html#URLvsURN)

    Like

Comments are closed.