URL vs URI vs URN: Key Differences with Examples
URL, URI, and URN are terms used to identify resources. They are related, but they do not mean exactly the same thing. This guide explains each term with practical examples.
Start with the resource: what are you identifying?
Web applications work with resources such as a web page, image, API endpoint, book record, or document. A URI (Uniform Resource Identifier) is the general term for a string that identifies a resource. URL and URN describe different ways an identifier can work.
What is a URI?
A URI identifies a resource according to a defined syntax. It does not, by itself, promise that a browser can open the value. Some URIs identify a network location; others identify a resource using a name or another scheme.
What is a URL?
A URL (Uniform Resource Locator) is a URI that describes where a resource can be found and the mechanism used to access it. For example:
https://www.example.com:443/products?id=42#detailsBreakdown: https is the scheme; www.example.com is the host; 443 is the port; /products is the path; ?id=42 is the query; and #details is the fragment. The default HTTPS port is 443, so browsers commonly omit it.
What is a URN?
A URN (Uniform Resource Name) identifies a resource by a persistent name within a namespace rather than by telling you its current network location. An example is urn:isbn:9780131103627, which illustrates an ISBN-style name. A URN does not automatically provide a web page to open.
Comparison at a glance
| Term | Purpose | Example | Does it tell you where to fetch it? |
|---|---|---|---|
| URI | General resource identifier | https://example.com/a | Depends on the URI type |
| URL | Identifies a location/access method | https://example.com/a | Usually, yes |
| URN | Identifies by a namespace-based name | urn:isbn:9780131103627 | Not by itself |
How to remember the difference
- URI: the umbrella term—an identifier.
- URL: an identifier that describes how/where to access the resource.
- URN: an identifier based on a name, intended to remain meaningful even if location changes.
In everyday web development, people often say “URL” when they mean a web address. In specifications and API design, “URI” may be used when the broader concept is intended.
Common mistakes
- Assuming every URI can be pasted into a browser and opened.
- Thinking URL and URI are competing formats. A URL is a kind of URI.
- Assuming a URN automatically resolves to a current location. Resolution requires a separate system or service.
Interview quick check
Question: Is every URL a URI? Answer: Yes, under the usual terminology, a URL is a type of URI. Is every URI a URL? No; the URI category is broader.
Frequently asked questions
Is URL the same as URI?
No. URL is a subset/type of URI focused on location and access, while URI is the broader identifier concept.
Can a URI be a URL and a URN?
URI is the umbrella category. URL and URN are commonly described as different URI forms, with different purposes.
Does a URN need the internet?
The identifier string itself does not necessarily require a live internet location. Finding a resource from it may require a resolver or registry.
Why do developers use the word URI in APIs?
It can be a standards-oriented, broader term when the exact identifier is not necessarily a browser-oriented URL.
What is a URL example?
https://example.com/products?id=42 is a URL example with a scheme, host, path, and query string.
Which term should I use in documentation?
Use “URL” for a web address users can visit. Use “URI” when discussing identifiers generally, and define the term if precision matters.
Learning tip: Try the examples in a test project before using them in production. Check official documentation for behavior that depends on a tool, database, or version.