URI vs. URL (Definitions, Differences, Types and Uses)

By Indeed Editorial Team

Updated 9 December 2022

Published 19 May 2022

The Indeed Editorial Team comprises a diverse and talented team of writers, researchers and subject matter experts equipped with Indeed's data and insights to deliver useful tips to help guide your career journey.

The internet is a common tool to search for information and perform work tasks. URI and URL are terms that identify and locate resources on the internet, such as webpages and documents. Learning about the differences between a URI vs a URL may help you become more effective when you browse the web. In this article, we examine the definitions of a URI vs a URL, explain the differences between them and provide reasons for using them.

Related: 10 Jobs with Computers (Plus Duties and Salary Information)

What are the definitions of a URI vs a URL?

To understand the differences between a URI vs a URL, it's important to examine their definitions. A uniform resource identifier (URI) uses a chain of characters to differentiate specific resources found on the internet or the server that hosts the content of a website. A uniform resource locator (URL) is a subtype of a URI that tells you how to access the resource or where to locate it.

URIs may contain a scheme name, authority, path, query and fragment. Nearly all URIs have a scheme name and a file path. URLs contain unique components, such as a protocol and a domain. You can directly access another webpage by entering a URL because your browser sends a request to the server that hosts that webpage.

Related: What Computer Skills Are Employers Seeking (Plus Examples)

Types of URIs

URIs and URLs have different file types that differentiate them from each other. URLs are a subset of URIs. Here are the two file types of URIs:

  • URL: URLs have a scheme whereby users can access online resources. It specifies a location on the network and the method for retrieving it.

  • URN: A Uniform Resource Name (URN) is a unique identifier within defined namespaces that exists for a long period even after the resource becomes unavailable. It specifies the URN scheme but you can't click on a URN link or search for it.

Types of URLs

URLs may comprise different components and serve different functions. Here are the major types of URLs:

  • Absolute URLs: These contain only the components that the URL requires to function so that it facilitates access to the web resource successfully.

  • Relative URLs: These don't contain all the required components. They can still function if programmers code them correctly in HTML documents.

  • Data URLs: Programmers use data URLs to embed content onto a webpage. Examples of such content are videos, images and documents.

  • Semantic URLs: Semantic URLs show the actual name of the specific web page you're trying to access and contain no special characters or symbols. They're simple to read and easy to understand.

  • Encrypted URLs: These help to prevent hacking and protect the files from unauthorised access. These URLs are secure and useful because users can't tamper with them.

All URLs have a scheme that shows the accessing protocol. Here are some protocols that URLs may use:

  • HTTP: Hypertext Transfer Protocol (HTTP) is a protocol that allows users to access resources on the web, such as webpages.

  • HTTPS: Hypertext Transfer Protocol Secure (HTTPS) is an extension of HTTP where users can use a secure protocol to surf the web for content and files.

  • FTP: File Transfer Protocol (FTP) allows for the transmission of files and documents between different computers through servers and networks.

  • LDAP: Lightweight Directory Access Protocol (LDAP) provides users with a way to access and maintain information on a directory by using an internet protocol.

  • Mailto: Mailto makes it convenient to use email addresses listed on a webpage. Users can click on the URL to send an email instead of copying and pasting the email address onto an email client.

Related: Backend Developer Path: Steps on How to Become One

Syntax of URIs

Syntax refers to the set of rules for using character structures in languages that computers can understand. URIs and URLs follow syntax rules so that they can function correctly. The syntax of a URI is:

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

Here are the components of a URI:

  • Scheme: A scheme contains a series of characters that begin with a letter. A combination of other letters, symbols and digits follow and it ends with a colon.

  • Authority: An authority is an optional component that starts with two slashes and contains three optional subcomponents of user info, host and port. User info may contain a username and an optional password.

  • Path: A path is a sequence that names the resource or its location. A slash separates the path segments and the specified path may be empty.

  • Query: A query is another optional element that begins with a question mark. It contains a query string of non-hierarchical data that allocates parameters to the search request.

  • Fragment: A fragment is also optional and starts with a hash symbol. It gives direction to a secondary resource.

Syntax of URLs

URLs usually contain several basic elements that identify the location of the web resource. This is an example of the syntax for a URL:

[protocol]://[domain name]/[folder name]/[webpage or resource name + optional extension]

Here are some common elements of URLs:

  • Protocol: A protocol represents the method a browser uses to access the resource. The most common protocols for websites are HTTP and HTTPS.

  • Domain name: A domain name is the registered name of the webpage, host or server ID. It usually begins with www. to show that the file exists on the internet.

  • Folder name: A folder name shows the sub-location of the resource within the main location of the website or server. Depending on the resource's location, there may be several folder name elements in the URL.

  • Webpage: This shows the complete path to the resource on the server. It may include a slash or an extension, such as .htm.

  • Query: A query is an optional element that specifies parameters for requests to access or file searches. It's a string that contains the name and value pair.

Related: What Does a Web Developer Do? (Plus Skills and Salary)

Differences between a URI vs a URL

URI and URL are two essential concepts of web browsing. It's important to understand the differences between them to become a more efficient internet user. Here are some areas where URI and URL differ:

Objective

A URI tells you the name of the resource on the internet while a URL shows both the name of the resource and the way to access it. URIs are identifiers while URLs are locators that tell you the address of a resource on the web. URLs point to a unique resource, such as a webpage, an image on a webpage or a file in an internet document.

Usage

You can use URIs to find resources on the internet and differentiate between HTML, XML, XSLT (Extensible Stylesheet Language Transformations) and other file types or tag libraries. You can use URLs to access resources by employing specific protocols. URLs reflect the address of the website and users can type the URL in the address bar of a web browser to go directly to the resource.

Scheme

The scheme for URIs can vary widely and can be a protocol, designation, specification or name. Some URIs may comprise many elements but it's not necessary to contain all of them. URIs only need a scheme name and file path. The file path can be empty. It's essential for the scheme of a URL to contain protocol information, such as HTTP, HTTPS or FTP. URIs don't contain protocol information.

Components

URIs and URLs have a sequence of characters that complete their names. While some components are common for both URIs and URLs, such as path and query, URLs may contain components that are absent in URIs, such as protocol and domain. The components for both URIs and URLs follow syntax rules to function successfully.

Related: How to Find Freelance Work as a Web Developer (Plus Tips)

Reasons for using URIs

Here are the reasons people use URIs:

  • Prevents ambiguity: URIs help to avoid ambiguity and are important to the semantic web. They allow for the creation of new file types without affecting the existing files.

  • Provides access to resources: URIs provide a way to share resources across the internet or across a network. Web browsers and peer-to-peer (P2P) file-sharing software use URIs to search for and download files.

  • Assigns multiple representations: You can assign multiple representations to a single resource when using URIs.

Related: What Are Web Developer Skills? (Definitions and Examples)

Reasons for using URLs

Here are the reasons for using URLs:

  • Easy to use: You can easily switch from one webpage to another with a single mouse click using the information in the URL. This makes it convenient to surf the internet.

  • Easy to access: URLs allow you to access a specific resource. A URL address points to a unique resource, such as a webpage, an image or a file application.

  • Promotes web traffic: Using simple words or a string in your URL can help promote web traffic and ensure that users access the correct pages on your website.

  • Prevents unauthorised access: URLs may also protect the privacy and security of files by preventing access from unauthorised users.

Related: How to Become a Freelance Web Developer in 7 Steps

Explore more articles