Difference between URL and URI


Uniform Resource Identifier (URI) and a Uniform Resource Locator (URL) are two terms often used in the area of web browsers and internet connections. Both can be used to reference web pages, images, documents, and other resources. However, they differ in their specific function. Understanding these differences is crucial in website development, as URIs can encompass a wider range of resources beyond just web locations. Here, we'll share the key distinctions between URIs and URLs and explore their roles in the vast world of the internet.

What is URI?

URI (Uniform Resource Identifier)is a string of characters that allows for identifying a resource on the internet with the help of name, location, or both. URI is categorized into two; URLs (Uniform Resource Locators) and URNs (Uniform Resource Names). URI includes scheme, authority, path, query, and fragment. HTTP, HTTPs, FTP, Idap, telnet, etc are the most commonly used URI schemes.

URI Syntax

  • Scheme: A scheme is an initial element containing a set of characters with a combination of letters, periods, digits, plus sign, or hyphen, followed by a colon (:). Even though nonregistered schemes can be used, it is compulsory to register URI schemes with the Internet Assigned Numbers Authority (IANA).
  • Authority: The authority component of the URL consists of multiple parts such as a host where the registered name or an IP address is added, an optional authentication section, and an optional port number. Double slashes (//) come between the scheme and authority part. The sub-parts in the authority element are user details, host, and post (optional) where user details and host are separated by a colon(:).
  • Path: It consists of a sequence of path segments separated by a slash indicating a hierarchical structure, but the path may be empty.
  • Query: It is a string of non-hierarchical data and is separated from the path before it with a question mark.
  • Fragment: It is an optional part starting with the hash(#) symbol. It directs to the specific part of the page you've accessed.

What is URL?

URL (Uniform Resource Locator) is a sub-version of URI with a protocol used to access resources on the World Wide Web. It is a string of characters indicating the specific location of a resource on the internet. The resource could be an image, a web page, etc. that is displayed by a URL. The URL's purpose in web browsing is to provide a standardized way to locate and access various types of content across the internet. The URL starts with http/https protocol is a web-type resource and FTP or mailto if the resource is a file or an email address.

There are several parts in the URL starting with a protocol(“http”/ “https”) and followed by the domain name and the path directed to the resource. An example of a URL is https://www.yarddiant.com.

Difference between URI and URL

URL is abbreviated as Uniform Resource Indicator. URL is abbreviated as Uniform Resource Locator.
Resources can be distinguished by URI regardless of the method. URL links a web page or a specific part of a web page by accessing methods like protocols.
URI is the superset of URN, which defines name, and URL, defining the location of the resource. URL is the subset of URI, defining the location of the resource.
There is no protocol specified in URI. Details of the protocol is provided in the URL.
Parts of URI include scheme, authority, path, query, and fragment. Parts of URLs include protocol, domain, path, hash, query, and many.
URI is commonly used in XML and tag library files for identifying resources and binaries. URL is used for searching web pages on the internet
URI can be created yourself with a registered domain name. URL can be created on your own with the whole control of domain name.

There are many chances of getting confused with the terms URL and URI. Each term is distinct from each other. With the differences mentioned above, I hope it is clear for you what exactly is URL and URI.