{"id":55432,"date":"2022-05-24T08:34:05","date_gmt":"2022-05-24T08:34:05","guid":{"rendered":"\/tutorials\/?p=55432"},"modified":"2025-09-03T09:41:45","modified_gmt":"2025-09-03T09:41:45","slug":"uri-vs-url","status":"publish","type":"post","link":"\/tutorials\/uri-vs-url","title":{"rendered":"URI vs URL: Key differences explained"},"content":{"rendered":"<p>A URI, or Uniform Resource Identifier, is a way to identify any resource online, such as a webpage, a document, an image, or something else entirely. Think of it as a unique ID. This identification can be based on the resource&rsquo;s name, its location, or both.<\/p><p>A URL, or Uniform Resource Locator, is a specific kind of URI. It identifies a resource and also tells you exactly where to find it and how to get there. It includes the access method, like <strong>https:\/\/<\/strong> and the address of the resource on the web, like <strong>www.example.com\/page<\/strong>.<\/p><p>Here&rsquo;s a quick breakdown of the main differences.<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Category<\/strong><\/td><td><strong>URI (Uniform Resource Identifier)<\/strong><\/td><td><strong>URL (Uniform Resource Locator)<\/strong><\/td><\/tr><tr><td>Purpose<\/td><td>To identify a resource by name, location, or both.<\/td><td>To locate a resource by specifying its access method and location.<\/td><\/tr><tr><td>Relationship<\/td><td>The superset of a URN and a URL.<\/td><td>The subset of URI.<\/td><\/tr><tr><td>Syntax<\/td><td>Contains components like a scheme, authority, path, and query.<\/td><td>Has similar components to a URI. Its authority consists of a domain name and a port.<\/td><\/tr><tr><td>Example<\/td><td>ISBN 0-476-35557-4<\/td><td>https:\/\/hostinger.com<\/td><\/tr><tr><td>Common use cases<\/td><td>Usually used in XML, tag library files, and other files, such as JSTL and XSTL.<\/td><td>Mainly used to search web pages on the internet.<\/td><\/tr><tr><td>Scheme definition<\/td><td>URI scheme can be a protocol, a specification, or a designation like HTTP, file, or data.<\/td><td>URL scheme is a protocol, such as HTTP and HTTPS.<\/td><\/tr><\/tbody><\/table><\/figure><p>The key distinction is that every URL is a type of URI, but not every URI is a URL.<\/p><p>Think of it like this:<\/p><ul class=\"wp-block-list\">\n<li>A URL is like their complete home address &ndash; it tells you exactly where to locate them.<\/li>\n\n\n\n<li>A URI is like a person&rsquo;s name &ndash; it identifies them.<\/li>\n<\/ul><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-key-differences-between-uri-and-url\">Key differences between URI and URL<\/h2><p>The main difference is that a URL specifies the protocol and the location of a resource, whereas a URI can identify a resource by name, location, or both.<\/p><p>Here&rsquo;s a breakdown of what that means in practice:<\/p><ul class=\"wp-block-list\">\n<li><strong>Scope: <\/strong>A URI is the parent category, representing the broadest term for any resource identifier. A URL is a specific kind of URI, making it a subset with a narrower focus.<\/li>\n\n\n\n<li><strong>Purpose:<\/strong> A URI&rsquo;s main purpose is to identify a resource with a unique name. Basically, it tells you what something is. A URL&rsquo;s purpose is to locate a resource by providing a web address &ndash; it tells you where to find it.<\/li>\n\n\n\n<li><strong>Syntax: <\/strong>A URI can have a flexible syntax. Its scheme can be a name (<strong>urn:<\/strong>), a protocol (<strong>https:<\/strong>), or another specifier. A URL has a stricter syntax that must include an access protocol like <strong>https<\/strong> or <strong>ftp<\/strong>.<\/li>\n\n\n\n<li><strong>Usage: <\/strong>URIs are often used in technical contexts like data schemas, such as XML, to give something a unique ID. URLs are used every day to access links, websites, and other resources in a web browser.<\/li>\n\n\n\n<li><strong>Example: <\/strong>A URI can be an identifier like <strong>urn:isbn:978-0321765723<\/strong>, which names a specific book but doesn&rsquo;t tell you where it is. A URL is a full address like <strong>https:\/\/www.hostinger.com\/tutorials<\/strong>.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-syntax-comparison-uri-vs-url\">Syntax comparison: URI vs URL<\/h2><p>While both share a common structure, a URL has stricter syntax rules and must contain specific components to be valid.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69e1e1d7ef100\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"373\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/url-vs-uri.jpg\/public\" alt=\"A visual explaining URL and URI\" class=\"wp-image-110087\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/url-vs-uri.jpg\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/url-vs-uri.jpg\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/url-vs-uri.jpg\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/05\/url-vs-uri.jpg\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Here&rsquo;s how the syntax compares:<\/p><h4 class=\"wp-block-heading\" id=\"h-scheme\">Scheme<\/h4><p>This is the first part of the address that ends with a colon, like <strong>https:<\/strong> or <strong>mailto:<\/strong>. It tells the computer what it&rsquo;s dealing with.<\/p><ul class=\"wp-block-list\">\n<li>In a URL, the scheme is an instruction, like <strong>https:<\/strong>, which tells your browser to fetch a webpage securely.<\/li>\n\n\n\n<li>In a URI, it can be more abstract. For example, <strong>urn:isbn:0451450523<\/strong> just names a book without telling you where to find it.<\/li>\n<\/ul><h4 class=\"wp-block-heading\" id=\"h-authority\">Authority<\/h4><p>This is the part right after the <strong>\/\/<\/strong> that usually contains the website&rsquo;s domain name, like <strong>www.hostinger.com.<\/strong><\/p><ul class=\"wp-block-list\">\n<li>For URLs that point to websites, the authority is how you know which server to connect to.<\/li>\n\n\n\n<li>For some URIs, this part isn&rsquo;t needed. An email link like <strong>mailto:example@email.com<\/strong> works perfectly fine without it.<\/li>\n<\/ul><h4 class=\"wp-block-heading\" id=\"h-path\">Path<\/h4><p>This part comes after the domain and looks like a folder path on your computer, such as <strong>\/tutorials\/uri-vs-url<\/strong>. It pinpoints the exact page or file you want on that website.<\/p><h4 class=\"wp-block-heading\" id=\"h-query\">Query<\/h4><p>This optional component starts with a <strong>?<\/strong> and is used to send extra information, like <strong>?search=how-to-build-a-website<\/strong>. Think of it as adding a filter to your request.<\/p><h4 class=\"wp-block-heading\" id=\"h-fragment\">Fragment<\/h4><p>This is an optional part that begins with a <strong>#<\/strong>, like <strong>#section-2<\/strong>. It tells your browser to jump directly to a specific part of the webpage, so you don&rsquo;t have to scroll to find it.<\/p><h3 class=\"wp-block-heading\" id=\"h-when-to-use-uri-vs-url\">When to use URI vs URL<\/h3><p>Knowing when to use each term depends on what you&rsquo;re trying to accomplish.<\/p><p><strong>Use a URL when you need to access a resource on the web. <\/strong>This is the most common use case.<\/p><p>If you&rsquo;re putting an address in a browser, linking to a page in your HTML, or calling an API endpoint, you&rsquo;re using a URL. It provides the complete address needed to retrieve something.<\/p><p><strong>Use a URI when you need to uniquely identify a resource, regardless of its location. <\/strong>This is more common in technical contexts.<\/p><p>For example, in XML or RDF files, a URI can act as a unique name for a data element or concept. Instead of pointing to a webpage, it just needs to be a unique identifier.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\"><\/h4>\n                    <p>Ever wondered what each part of that address actually does? Our detailed guide on <a href=\"\/tutorials\/what-is-a-url\">what a URL is<\/a> breaks it all down.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-real-world-use-cases-of-uri-and-url\">Real-world use cases of URI and URL<\/h2><p>Let&rsquo;s look at how URIs and URLs are applied in different scenarios to make the distinction clearer.<\/p><h3 class=\"wp-block-heading\" id=\"h-uri-use-cases\">URI use cases<\/h3><h4 class=\"wp-block-heading\" id=\"h-naming-resources\">Naming resources<\/h4><p>URIs are used to assign unique serial numbers to creative works. This allows them to be identified in databases and catalogs without pointing to a specific file online.<\/p><p>For example, an ISBN (International Standard Book Number), like <strong>urn:isbn:978-0321765723<\/strong>, uniquely identifies a specific book but doesn&rsquo;t tell you where to find it online.<\/p><p>Similarly, an ISAN (International Standard Audiovisual Number), like <strong>urn:isan:0000-0004-87D7-0000-Q-0000-0000-6<\/strong> can identify a movie without providing a link to watch it.<\/p><h4 class=\"wp-block-heading\" id=\"h-identifying-telephone-numbers\">Identifying telephone numbers<\/h4><p>The <strong>tel:<\/strong> scheme creates a URI that identifies a telephone number.<\/p><p>For example, <strong>tel:+1-816-555-6666<\/strong> is a globally unique identifier for a phone number. It doesn&rsquo;t refer to a physical device but simply names the resource.<\/p><h3 class=\"wp-block-heading\" id=\"h-url-use-cases\">URL use cases<\/h3><h4 class=\"wp-block-heading\" id=\"h-web-pages\">Web Pages<\/h4><p>This is the most common use case. When you type an address into your browser or click a link, you&rsquo;re using a URL to navigate the internet.<\/p><p>These are often absolute URLs, containing the full protocol, domain, and path, like <strong>https:\/\/www.hostinger.com\/tutorials\/uri-vs-url<\/strong>.<\/p><h4 class=\"wp-block-heading\" id=\"h-internal-pages\">Internal pages<\/h4><p>URLs can also appear without a protocol and domain, specifying only the path. Known as relative URLs, they link to a file within the same website.<\/p><p>For example, the relative URL for the page above would simply be <strong>\/tutorials\/uri-vs-url<\/strong>.<\/p><h4 class=\"wp-block-heading\" id=\"h-rest-apis\">REST APIs<\/h4><p>In API development, endpoints are represented by URLs. For instance, <strong>https:\/\/api.example.com\/users\/123<\/strong> is a URL that allows an application to interact with the data for <strong>user 123<\/strong>.<\/p><h4 class=\"wp-block-heading\" id=\"h-search-engine-optimization-seo\">Search engine optimization (SEO)<\/h4><p>Search engines like Google crawl and index URLs to understand a website&rsquo;s structure and content. Clean, descriptive URLs are a best practice for helping both users and search engines.<\/p><h4 class=\"wp-block-heading\" id=\"h-email-addresses\">Email addresses<\/h4><p>A URL can specify an email address using the mailto: scheme, such as <strong>mailto:abc@example.com<\/strong>. Clicking this link on a webpage typically opens your default email client.<\/p><h4 class=\"wp-block-heading\" id=\"h-redirects\">Redirects<\/h4><p>URLs are crucial for redirecting users from an old page to a new one. For example, if a blog moves from <strong>blog.example.com<\/strong> to <strong>example.com\/blog<\/strong>, a redirect ensures that users accessing the old URL are automatically sent to the new location, preventing 404 errors.<\/p><h4 class=\"wp-block-heading\" id=\"h-remote-access\">Remote Access<\/h4><p>URLs can use protocols other than HTTP. For example, the <strong>telnet:\/\/192.0.2.16:80\/<\/strong> URL is used to connect to a remote computer at a specific IP address and port, often for troubleshooting servers.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-are-uris-and-urls-related\">How are URIs and URLs related?<\/h2><p>The relationship between URI and URL is hierarchical. URI is the parent category, and URL is one type of URI.<\/p><p>Think of it like this:<\/p><ul class=\"wp-block-list\">\n<li><strong>URI (Identifier)<\/strong> is like the concept of a person&rsquo;s identity.<\/li>\n\n\n\n<li>A <strong>URL (Locator)<\/strong> is like a person&rsquo;s home address. It tells you where to find them.<\/li>\n\n\n\n<li>A <strong>URN (Name)<\/strong> is like a person&rsquo;s unique national ID number. It identifies them but doesn&rsquo;t say where they live.<\/li>\n<\/ul><p>Both a home address and an ID number are forms of identification, but they serve different functions. Every URL provides a location, making it an identifier. But not every identifier provides a location.<\/p><h2 class=\"wp-block-heading\" id=\"h-should-i-use-url-or-uri\">Should I use URL or URI?<\/h2><p>It all depends on what you&rsquo;re trying to do. If you&rsquo;re linking to a webpage, a stylesheet, or an image online, you&rsquo;re using a URL.<\/p><p>If you&rsquo;re a developer defining a unique identifier for a piece of data in a schema that won&rsquo;t be accessed over the web, you&rsquo;re using a URI.<\/p><p>In practice, unless you&rsquo;re a developer, a URL is what you will use for almost everything you do online. It&rsquo;s the locator for all the resources we need when browsing websites or developing them.<\/p><p>The heart of every URL is its domain name. To get the full picture, check out our guide on <a href=\"\/tutorials\/what-is-a-domain-name\"><strong>what a domain name is<\/strong><\/a> and how to choose the perfect one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A URI, or Uniform Resource Identifier, is a way to identify any resource online, such as a webpage, a document, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/uri-vs-url\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":86979,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"URI vs URL: Key differences explained","rank_math_description":"Not sure about URI vs URL? We explain the key differences in plain language. Clear examples, easy comparisons, and exactly when to use each.","rank_math_focus_keyword":"uri vs url","footnotes":""},"categories":[22631],"tags":[],"class_list":["post-55432","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domains"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/uri-vs-url","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/uri-e-url","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/uri-vs-url","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/uri-vs-url","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/perbedaan-uri-vs-url","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/uri-vs-url","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/uri-vs-url","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/uri-vs-url-differences-and-when-to-use-them","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/uri-vs-url-differences-and-when-to-use-them","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/uri-vs-url","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/uri-vs-url","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/uri-vs-url","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/uri-e-url","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/uri-vs-url","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/uri-vs-url","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/uri-vs-url","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/uri-vs-url","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/55432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=55432"}],"version-history":[{"count":44,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/55432\/revisions"}],"predecessor-version":[{"id":133308,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/55432\/revisions\/133308"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/86979"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=55432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=55432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=55432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}