Definition
These three acronyms - URI, URL, and URN - cause more confusion than almost any other web terminology. Here is the simple truth: URI is the parent category, and both URLs and URNs are specific types of URIs. Think of it like “vehicles” (URI) including both “cars” (URL) and “license plates” (URN).
A URL (Uniform Resource Locator) tells you WHERE something is and HOW to get it. https://api.example.com/users/123 is a URL - it gives you the protocol (https), the location (api.example.com), and the path (/users/123). You can literally use this to locate and retrieve the resource right now.
A URN (Uniform Resource Name) is a permanent identifier that does not tell you where something is. urn:isbn:978-3-16-148410-0 identifies a specific book regardless of which bookstore or library has it. The book’s URN never changes even if it moves between stores or goes out of print. URNs are about identity, not location.
Here is the practical reality: in day-to-day web development, you are almost always working with URLs. The term “URI” is technically more correct in many contexts (the HTTP spec uses “URI”), but “URL” is what most people say. URNs are mainly used in specialized contexts like digital libraries, publishing standards, and persistent identifiers.
Example
Every web address you use: https://github.com/user/repo is a URL. It tells you where GitHub is, what protocol to use, and which specific repository you want. This is what you work with 99% of the time.
Book identifiers: urn:isbn:0451450523 is a URN - it identifies a specific book (The Hitchhiker’s Guide to the Galaxy) regardless of where you can buy it. Amazon, Barnes & Noble, and your local library all have the same book - the URN identifies it universally.
API endpoints: Every REST API endpoint is a URL. /api/v1/users tells you the path to a resource. Combined with a base URL, you can locate and access it.
UUID identifiers: When systems use UUIDs like urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6, they are using URNs to create globally unique identifiers that are not tied to any location.
Analogy
Street Address vs. Social Security Number: A URL is like a street address - it tells you exactly where to find something (123 Main St, Anytown). A URN is like a Social Security Number - it uniquely identifies something regardless of where it currently is. You can change addresses, but your SSN stays the same. URI is the general concept of “ways to identify things.”
GPS Coordinates vs. Person’s Name: GPS coordinates (URL) tell you exactly where something is right now. A person’s legal name (URN) identifies them regardless of where they are standing. If someone asks “how do I find John Smith?” you might give them coordinates (URL) or just the name (URN) for them to look up themselves.
Phone Number vs. Email Address: A phone number is location-independent (like a URN) - it identifies you regardless of where you are. A physical address is location-specific (like a URL). Both are ways to reach you (URIs), but they work differently.
The Library Catalog: A book’s location in a library (URL) might be “3rd floor, shelf B, position 47.” The book’s catalog number (URN) might be “823.912 ORW” - this identifies the book even if it moves shelves or is checked out.
Code Example
// URL (most common in APIs)
https://api.example.com/v1/products/123
|___| |______________| |_____________|
scheme authority path
// URN (location-independent)
urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6
urn:isbn:0451450523
// URI (generic term for both)
const resourceUri = 'https://api.example.com/users/123'; // This is a URL
const bookUrn = 'urn:isbn:978-3-16-148410-0'; // This is a URN
// In HTTP headers
GET /users/123 [HTTP/1.1](https://reference.apios.info/terms/http-1-1/)
Host: api.example.com
// Full URI: https://api.example.com/users/123