Difference between URL and URI

URL (Uniform Resource Locator):
URL (Uniform Resource Locator) is often defined as a string of characters that is directed to an address. It is a very commonly used way to locate resources on the web. It provides a way to retrieve the presentation of the physical location by describing its network location or primary access mechanism.

The protocol is described within the URL which is employed to retrieve the resource and resource name. The URL contains http/https at the start if the resource may be a web type resource. Similarly, it begins with ftp if the resource may be a file and mailto if the resource is an email address. The syntax of an URL is shown below where the primary part is employed for protocol and the remainder of the part is employed for the resource which consists of a website name or program name.

https://www.geeksforgeeks.org/minimum-cost-graph

Here, the domain name describes the server (web service) and program name (path to the directory and file on the server).



URI (Uniform Resource Identifier):
Similar to URL, URI (Uniform Resource Identifier) is also a string of characters that identifies a resource on the web either by using location, name or both. It allows uniform identification of the resources. A URI is additionally grouped as a locator, a name or both which suggests it can describe a URL, URN or both. The term identifier within the URI refers to the prominence of the resources, despite the technique used.

The former category in URI is URL, during which a protocol is employed to specify the accessing method of the resource and resource name is additionally laid out in the URL. A URL may be a non-persistent sort of the URI. A URN is required to exist globally unique and features a global scope.

Difference between URL and URI:

URL URI
URL is used to describe the identity of an item. URI provides a technique for defining the identity of an item.
URL links a web page, a component of a web page or a program on a web page with the help of accessing methods like protocols. URI is used to distinguish one resource from other regardless of the method used.
URL provides the details about what type of protocol is to be used. URI doesn’t contains the protocol specification.
URL is a type of URI. URI is the superset of URL.

GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.