The Internet is powered by acronyms. There’s HTTP which allows clients and servers to connect with each other and there’s SSL which is used to keep data secure. If you’ve spent any time working as a web developer, you’ve likely also encountered the URL and URI acronyms.
The URL and URI acronyms may look similar but they do have subtle differences. It doesn’t help that many developers themselves don’t know the difference between them, but we’re here to make sure you are aware.
In this guide, we’re going to discuss URLs, URIs and the difference between these two concepts so you’ll know how to use the terms correctly.
What is a URL?
A URL, which stands for Uniform Resource Locator, is an identifier that tells your computer to access a resource on a web server. Many people confuse a URL with a domain name, but these are separate concepts.
On the Internet, computers rely on IP addresses to identify servers and connect to them. But inputting an IP address isn’t ideal for most people. IP addresses are a sequence of numbers. Who wants to remember a sequence of numbers to access a website?
A URL is all of the information you need to access a resource on a website. Here’s an example of a URL taken from this web page:https://careerkarma.com/blog/url-vs-uri
This entire sequence of characters is a URL. Let’s break it down:
- HTTPS: This is the HTTP secure protocol that allows you to connect to this site.
- careerkarma.com: This is the domain name to which you are connecting.
- /blog/url-vs-uri: This is the resource on the Career Karma web server that you are accessing.
This string of characters tells our web servers what resource to send you. URLs can also contain query strings and other pieces of information.
In short, URLs allow web servers to locate a resource on a web server.
What is a URI?
A Uniform Resource Identifier is an identifier of a resource. A URI may refer to a web page, a book or a document.
URLs are a type of URI because they allow you to identify a particular resource on the web. But URIs are not confined to web development.
For instance, the International Standard Book Number system uses a protocol called a Uniform Resource Name to identify individual books. URNs are also a type of URI because they allow you to uniquely identify a service.
When You Should Use a URL or URI
You may be thinking to yourself: isn’t this all semantics? Does it really matter when I use each term? While other developers may use URL and URI interchangeably, there are specific instances where you should use one of the two.
The term URL should be used to identify a web resource. Here are a few example URLs:
The term URI can also be used to identify a web resource, but generally you should use the term URL. While all of the above examples may also be URIs, a book number could also be a URI. This can result in confusion if you’re having a discussion featuring both URLs and URIs.
The rule is simple: All URLs are URIs, but not all URIs are URLs. URLs are a subset of URIs.
Uniform Resource Locators are a type of Uniform Resource Indicator that include the network location of a web resource. When you navigate to a website or access a web resource – whether it is a file, a login server or something else – you are accessing it through a URL.
URLs are technically URIs, but they are a more specific term used to describe how you interact with web resources. You’re best to use URI if you are talking about different types of identifiers. For instance, if you’re talking about both ISBN book numbers and URLs in the same discussion, you could refer to them both as URIs.