What Is the Difference Between a URI, a URL, and a URN?
When working with the web, you’ll often encounter the terms URI, URL, and URN. While they’re related, each has a specific meaning and purpose. Understanding their distinctions helps clarify how resources are identified, located, and named online.
Definitions
URI: Uniform Resource Identifier
- What it is: The most general term. A URI is a string of characters that uniquely identifies a resource, either by name, location, or both.
- Role: Acts as an umbrella concept that includes both URLs and URNs.
- Syntax example:
scheme:[//authority]path[?query][#fragment]
Example:mailto:info@example.com
orhttps://www.example.com/page
[1][2][3].
URL: Uniform Resource Locator
- What it is: A type of URI that provides the means to locate a resource by describing its primary access mechanism (protocol) and network location (address).
- Role: Tells you where a resource is and how to access it.
- Syntax example:
https://www.example.com/index.html
Components: protocol (https), domain (www.example.com), path (/index.html)[1][3][4].
URN: Uniform Resource Name
- What it is: Another type of URI that names a resource in a persistent, location-independent way.
- Role: Tells you what a resource is, but not where to find it.
- Syntax example:
urn:isbn:0451450523
Here, the URN identifies a book by its ISBN, regardless of where it is stored[1][5][3].
Key Differences at a Glance
Feature | URI | URL | URN |
---|---|---|---|
Stands for | Uniform Resource Identifier | Uniform Resource Locator | Uniform Resource Name |
Purpose | Identifies a resource (by name, location, or both) | Specifies the location and access method of a resource | Names a resource in a persistent way |
Is a… | Superset (includes URL and URN) | Subset of URI | Subset of URI |
Locates resource? | Not necessarily | Yes | No |
Names resource? | Yes | Sometimes | Yes |
Example | mailto:info@example.com | https://www.example.com/about | urn:isbn:0451450523 |
Visual Analogy
- URI is like a unique identifier for anything—think of it as a passport.
- URL is like a street address—it tells you where to go and how to get there.
- URN is like a person’s name—it tells you who or what something is, but not where to find it[2][5][3].
Practical Examples
- URI:
https://www.example.com
(also a URL)urn:isbn:0451450523
(also a URN)mailto:info@example.com
- URL:
https://www.example.com/index.html
ftp://ftp.example.com/file.txt
- URN:
urn:isbn:0451450523
urn:uuid:123e4567-e89b-12d3-a456-426614174000
[1][5][4]
Summary
- All URLs and URNs are URIs, but not all URIs are URLs or URNs.
- URL: Locates a resource and provides access details.
- URN: Names a resource in a persistent, location-independent way.
- URI: The broadest term, encompassing both URLs and URNs.
Understanding these distinctions is essential for web development, networking, and working with digital resources[1][2][3].
References:
[1] https://blog.bytebytego.com/p/ep66-comparison-of-url-uri-and-urn
[2] https://auth0.com/blog/url-uri-urn-differences/
[5] https://laconsole.dev/blog/differences-uri-url-urn
[3] https://www.designgurus.io/answers/detail/what-are-the-difference-between-url-uri-and-urn
[4] https://www.softwaretestinghelp.com/url-vs-uri/
[1] https://blog.bytebytego.com/p/ep66-comparison-of-url-uri-and-urn [2] https://auth0.com/blog/url-uri-urn-differences/ [3] https://www.designgurus.io/answers/detail/what-are-the-difference-between-url-uri-and-urn [4] https://www.softwaretestinghelp.com/url-vs-uri/ [5] https://laconsole.dev/blog/differences-uri-url-urn [6] https://wiki.digitalclassicist.org/URIs_URNs_and_URLs:_What’s_the_difference%3F [7] https://www.alsacreations.com/article/lire/1930-URL-URI-URN-quelles-differences.html [8] https://bytebytego.com/guides/guides/url-uri-urn-do-you-know-the-differences/ [9] https://www.hostinger.com/fr/tutoriels/uri-vs-url [10] https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/urn [11] https://geekflare.com/difference-between-url-uri-and-urn/ [12] https://dev.to/logto/unveiling-uri-url-and-urn-12b6 [13] https://en.wikipedia.org/wiki/Uniform_Resource_Identifier [14] https://www.hostinger.com/tutorials/uri-vs-url [15] https://www.youtube.com/watch?v=iUzyy8CnPVY [16] https://en.wikipedia.org/wiki/Uniform_Resource_Name [17] https://codefinity.com/blog/URL-vs-URI-vs-URN [18] https://dev.to/endorama/uri-url-urn-identifying-resources-on-the-web-ebc [19] https://stackoverflow.com/questions/4913343/what-is-the-difference-between-uri-url-and-urn/28865747 [20] https://www.youtube.com/watch?v=D5GlUmNXTXE