URL vs. URI vs. URN: What Each Term Means

Learn the difference between a URL, URI, and URN, explore the parts of a web address, and see why developers often use URL and URI interchangeably.

Published
Reading time
5 min read
URL vs. URI vs. URN: What Each Term Means
On this page

A web address is often called both a URL and a URI, while a URN may look like an address but not tell you where to retrieve anything. Understanding URL vs URI vs URN helps when reading standards, documentation, and API names.

Key Takeaways

  • A URI is an identifier for a resource. URL and URN describe different ways an identifier can work.
  • A URL identifies a resource by its location or access mechanism. An HTTPS web address is a familiar example.
  • A URN identifies a resource by name within a namespace; it does not itself specify where to find it.
  • In everyday web development, “URL” and “URI” are often used interchangeably because most identifiers developers handle are web URLs.

URI, URL, and URN: The Difference

TermMeaningExample
URIA string that identifies a resourcehttps://example.org/docs
URLAn identifier that indicates a location or access mechanismhttps://example.org/docs
URNA name-based identifier in a URN namespaceurn:isbn:9780140328721

The HTTPS example is both a URL and a URI. The ISBN example is a URN and therefore also a URI. Its isbn namespace indicates that the following value is an ISBN; the URN does not itself provide a network address for the book.

These labels describe how an identifier works, not necessarily three completely separate kinds of string. In particular, not every URI is a web URL. A URN may be looked up through a service that understands its namespace, but the URN alone does not specify that service or guarantee that the resource can be retrieved.

Advertisement

Anatomy of a Web URL

Consider this fictional address:

https://example.org:8443/guides/url-basics?lang=en&level=beginner#examples

Its components are:

ComponentValueWhat it represents
SchemehttpsThe scheme used to interpret and access the URL
Authorityexample.org:8443The host and, here, an explicit port
Path/guides/url-basicsA path identifying a resource on the server
Querylang=en&level=beginnerAdditional data interpreted by the application
FragmentexamplesA reference to a part or state of the retrieved resource

The punctuation separates the components: : follows the scheme, // introduces the authority, ? introduces the query, and # introduces the fragment. The colon before 8443 separates the host from the port.

In generic URI syntax, the shape is:

scheme:[//authority]path[?query][#fragment]

Square brackets here mean the enclosed portion is optional; they are not literal characters to add to a URI. An authority is not required for every URI. For example, urn:isbn:9780140328721 has a scheme and a path-like scheme-specific portion, but no // authority.

The query in the HTTPS example uses familiar key=value pairs separated by &. That is a common convention, not a requirement that every URI query consist of key-value pairs. The application determines what the query means.

The fragment is handled by the client and is not sent as part of the HTTP request target. A browser might use it to navigate to an element or an application might interpret it as client-side state. Its meaning depends on the resource and client.

Why Developers Use URL and URI Interchangeably

Most addresses encountered in web applications are HTTP or HTTPS URLs, so they also fit the broader URI category. A framework may use “URI” in an API name even when the value being handled is an ordinary web address. In conversation, calling that value either a URL or a URI usually causes no confusion.

Precision matters when an API accepts more than web addresses. For example, a function that accepts URNs as identifiers has a broader purpose than a function that fetches HTTPS URLs. Check the API’s documentation and accepted schemes rather than assuming its name tells you exactly what it can process.

Modern browser APIs also use the term “URL” for their parsing model. Their handling and normalization of input can differ from generic URI syntax, so use the relevant API or standard when exact parsing behavior matters.

Advertisement

When a URN Is Useful

A URN is useful when you want to identify something by a name in a defined namespace rather than encode a particular network location. For example, an ISBN URN can identify a book independently of a particular retailer’s page.

That does not make URNs a common replacement for web addresses. A browser needs a suitable location and access mechanism to retrieve a web page; a URN alone does not provide one. Resolution services can connect an identifier to a location, but availability and behavior depend on the service and namespace.

Common Mistakes

  • Treating every URI as a fetchable web address. A URI can identify a resource without specifying an HTTP location.
  • Assuming a URN guarantees permanence. Naming and resolution depend on the namespace and the systems that maintain it.
  • Calling the whole authority the hostname. In the example, example.org is the host; :8443 is the port.
  • Assuming the fragment reaches the server. The fragment is not part of the HTTP request target.
  • Treating a relative reference as a complete URI. A reference such as /guides/url-basics needs a base URI to resolve it into an absolute identifier.

Best Practices

  • Use URL when discussing a web address or a browser URL API; use URI when the broader identifier category matters.
  • Keep the scheme, authority, path, query, and fragment separate when explaining or processing an address.
  • Use a parser appropriate to your runtime instead of splitting URLs manually. Parsing alone is not a security check for a service that fetches user-supplied URLs.
  • Check the relevant standard and implementation documentation for edge cases, including encoding and normalization.

Conclusion

A URL is the familiar location-oriented identifier used for web addresses; a URN is a name-based identifier. Both fit under the broader URI concept. The distinction is most useful when an application handles identifiers beyond ordinary HTTP and HTTPS URLs.

This overview follows the general terminology of RFC 3986 and RFC 8141. Documentation retrieval was not available for this draft, so consult those standards and the WHATWG URL Standard for normative details.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.