What Is the Difference Between URL, URI, and URN


URL is called Uniform Resource Locator, which means Uniform Resource Locator. A URL is a string of characters, which can be letters, numbers, and special symbols. A URL is the address of a given unique resource, pointing to the location of that unique resource.

The syntax of the URL is as follows.

URL Syntax

scheme: communication protocol, including HTTP, HTTPS, FTP, MAILTO, IRC, FILE, etc.

authority: consists of two parts: host: host, server (computer) Domain Name System (DNS), hostname or IP address; port: port number, optional, the default port when omitted, such as the default port of HTTP is 80, the default of HTTPS The port is 443.

path: used to represent a directory or file address on the host.

query: query parameters. Multiple parameters are separated by "&", and the name and value of each parameter are separated by "=". (Such as age=18)

fragment: information fragment, the target of jumping within a given page.

Examples of URLs:


What is the relationship between URL and link? Although the two terms are often used interchangeably, they are not technically synonymous. A URL is a string that can be used to locate a resource, while a link (short for hyperlink) is an HTML element that loads a resource from a given URL in the browser. So, links depend on URLs, and URLs without links can exist, but links without URLs are meaningless.


The full name of URI is Uniform Resource Identifier, which means Uniform Resource Identifier. URI is a standard method for identifying resources by Location, Name, or both. There are two subsets of URI, URL, and URN.

The syntax of the URI is as follows.

URI Syntax

It can be seen that the main difference between the syntax of URI and URL is authority, which contains three contents.

User info: optional, may contain username and password (optional), separated by a colon (:) followed by an @ sign.

Host: domain name or IP address.

Port: points to the port number of the domain or IP address.

Examples of URI:


Both URI and URL follow the same specification: RFC 3986. However, a URL can locate a resource, and a URI simply identifies the resource. All URLs can be URIs, but not all URIs are URLs, because a URI contains both a URL and a URN.


The full name of URN is Uniform Resource Name, which means Uniform Resource Name. Uniform resource names provide information about the resource itself, including only the name or identification of the resource, but not the protocol or address used to access the resource. It identifies the resource in a permanent way, even if the resource no longer exists. It identifies resources in a given namespace by name, which refers to a set of names or identifiers.

The syntax of URN is as follows.

URN Syntax

scheme: the scheme specification (**urn:**) is not case sensitive.

NID: namespace identifier, which can include letters, numbers, and a hyphen (-) followed by a colon (:).

NSS: namespace-specific string. NSS may contain ASCII letters, numbers, punctuation, and special characters.

Examples of URN:


Unlike URLs, URNs don't provide any information about locating a resource, just identify it. For example, the ISBN code of a book belongs to the URN, which is used to identify a certain book, but it is not a URL because it does not specify how to retrieve the book.


To sum up, the difference between URL, URI, and URN is as follows: Both URL and URN are subsets of URI.

Both URL and URN are subsets of URI.

URL: used to identify network resources, specify the operation or access method, and include access mechanism and network location.

URN: identifies a resource with a namespace-specific name. Include the name (the given namespace), but not the access method.

Leave a reply