A URI identifies a resource; a URL is a URI used to identify a resource by location or access mechanism under traditional terminology. Many web addresses are both. The modern WHATWG URL Standard and RFC 3986 define relevant but different parsing models for developers.
Use this guide to understand URI, URL and URN differences, URL components, relative references, encoding, browser parsing and practical security checks.
URI Vs URL: The Essential Difference
A Uniform Resource Identifier, abbreviated URI, is a standardized sequence of characters used to identify a resource. A Uniform Resource Locator, abbreviated URL, is traditionally understood as a URI that also provides a way to locate or access the resource. The terms overlap: an ordinary web address such as https://example.com/articles/guide is both a URI under the generic syntax and a URL in everyday web terminology.
The distinction matters when reading API documentation, browser standards and programming libraries. RFC 3986, the Uniform Resource Identifier Generic Syntax, describes URI as a broader identifying concept and notes that URL refers to a subset of identifiers that provides a means of locating a resource. In practice, software documentation frequently uses URL for network-accessible addresses and URI for the more general syntax or an identifier reference.
A name-like example is urn:isbn:9780131103627. It identifies an ISBN through a URN scheme rather than giving an ordinary HTTP server location to fetch. A locator example is https://example.com/books/, which includes a scheme and host from which a web client can attempt to obtain information. This difference does not imply that every syntactically valid web URL returns a successful webpage.
The modern WHATWG URL Standard defines the browser-oriented URL parser and serializer that web applications use. It is not simply a restatement of every sentence in RFC 3986. For developers, that distinction explains why a browser may normalize or reject a URL differently from a generic URI parser.
Our API guide explains the services that use these identifiers. The central lesson is to understand an identifier’s intended scheme, representation and resolution rules rather than relying on the acronym alone.
Examples Of URIs, URLs And URNs
A comparison of concrete examples is more useful than saying that one concept is always just a website. A URI can use a registered or defined scheme that identifies a resource in different ways. A URL commonly combines an access scheme with location-related information. A URN supplies a persistent-style name under its namespace rules, though the persistence of any actual identifier depends on its issuer and governance.
| Example | General Classification | Explanation |
|---|---|---|
https://example.com/help | URL And URI | Web Address With Access Scheme |
https://example.com/help#setup | URL And URI Reference | Web Address With Fragment |
urn:isbn:9780131103627 | URN And URI | Namespace-Based Identifier |
/help/setup | Relative Reference | Needs A Base URI To Resolve |
mailto:hello@example.com | Scheme-Specific URI | Requests Mail Composition Behavior In Supporting Software |
The documentation domains and example addresses here are teaching examples. A mailto URI does not guarantee that the recipient address exists, and an HTTPS URL does not guarantee server availability. The identifier can be syntactically meaningful even when the associated action cannot complete.
RFC 3986 describes both absolute URIs and relative references. A value like ../images/logo.png is a reference that must be resolved against an appropriate base rather than a fully independent location. This is common in HTML, CSS and API clients.
Avoid the simplified claim that a URI never locates anything while a URL never names anything. A web URL both identifies a resource and supplies access information. Terminology remains contextual, but the standards provide reliable boundaries.
Anatomy Of A Web URL
Consider https://docs.example.com:8443/guides/start?lang=en#install. The scheme is https. The host is docs.example.com. The port is 8443. The path is /guides/start. The query is lang=en. The fragment is install. These components have distinct meanings and not every URL contains all of them.
https
docs.example.com
8443
/guides/start
lang=en
install
The authority portion of a generic URI can include user information, a host and a port, where the scheme permits them. In ordinary HTTPS URLs, embedded credentials should not be treated as a safe credential management practice. Modern browsers and servers have additional requirements and restrictions.
A fragment identifies a secondary resource or location within the retrieved representation. In an ordinary HTTP request, the fragment is interpreted by the client and not sent as part of the request target to the server. That is why a section link can change a page’s position without necessarily causing a different document to be fetched.
Our DNS guide explains how a hostname may be resolved to network addresses, while IP addressing describes the resulting network-level identifiers. A URL host and an IP address are related but not interchangeable components.
URI Schemes And Why They Matter
The scheme appears before the first colon and indicates how the rest of the identifier should be interpreted. HTTPS and HTTP are familiar web schemes, but URI schemes are not limited to web retrieval. The mailto scheme commonly describes a mailbox-related action, and urn identifies resources through namespace-specific naming conventions.
A scheme can affect permitted syntax, interpretation and application behavior. For example, https://example.com/ and mailto:person@example.com have different purposes. The first is a web location that can be handled by an HTTP client. The second can instruct compatible software to prepare an email message. Neither example means the client has already completed the requested action.
RFC 3986 provides the generic syntax and expects individual scheme specifications to define additional requirements. A system that strips off the scheme and assumes every remaining string is a web hostname may handle legitimate identifiers incorrectly.
The WHATWG URL Standard focuses on interoperable parsing behavior for web platforms and defines special handling for particular schemes. A generic URI validator and a browser URL parser may therefore disagree about exact normalization or error handling. When writing web code, prefer the supported platform URL API for browser-oriented input.
A common developer mistake is validating URLs solely with one short regular expression. Real URL parsing has many edge cases involving encoded characters, IPv6 hosts, Unicode domains and relative references. A supported parser plus a policy for allowed schemes is safer.
For applications that fetch remote content, scheme validation is also a security requirement. Allow only intended schemes and hosts, and evaluate redirects before letting untrusted input control internal network requests. See our firewall overview for related network boundaries.
Absolute URIs And Relative References
An absolute URI includes a scheme, whereas a relative reference is interpreted in relation to a base URI. Web documents often use relative references for their own resources because they make websites easier to move between environments without hardcoding the full hostname into every link.
Suppose a page’s base is https://example.com/docs/start. A reference such as images/picture.png resolves relative to its path context, while /images/picture.png starts from the site’s root. A reference beginning with #faq selects a fragment within the current resource. The exact resolution behavior follows the applicable standard and base.
A relative reference is not a malformed URL merely because it lacks https. It can be entirely valid when a base is available. But it is insufficient as a standalone remote address if the receiving program has no context for resolution.
The WHATWG URL API commonly accepts a relative string with an explicit base, such as new URL("../help", "https://example.com/docs/start"). The result can be serialized as an absolute URL. A single-argument constructor may reject the same relative input without a suitable base.
Developers should not implement resolution by naive string concatenation. A path with ../, an absolute-path reference or a query-only reference can produce different results than simply appending text to a base string.
Our client server architecture guide explains how browsers request linked resources. Correct reference resolution determines which server and resource the client contacts.
Percent Encoding And Special Characters
URI syntax reserves some characters for structural roles. Percent encoding represents a byte using a percent sign followed by two hexadecimal digits. For example, %20 represents a space byte in many relevant contexts. Encoding data helps distinguish literal content from syntax delimiters such as question marks and slashes.
RFC 3986 specifies percent encoding and warns about interpreting reserved characters in the wrong component. A question mark that separates a query from a path is not equivalent to a percent-encoded question mark that belongs to path data. Likewise, a slash within one identifier component can be meaningful in a way that changes if it is decoded prematurely.
Unicode text adds complexity because non-ASCII characters are commonly encoded as UTF-8 bytes and then percent encoded where needed. A visibly simple phrase can therefore be represented by several encoded bytes. Decoding must follow the correct character encoding and component rules.
The WHATWG URL Standard also includes the application/x-www-form-urlencoded format used by many web forms. In that encoding, the plus sign has a special space-related role. It would be a mistake to assume that plus and %20 are interchangeable in every URI component.
Double encoding and double decoding can create errors or security vulnerabilities. A server that decodes part of a path more than once may interpret data differently from the component that enforced access policy.
For the underlying bytes and character encodings, see our binary data article. URI encoding works on representations; it is not encryption or proof of a trustworthy destination.
Query Strings And Fragment Identifiers
A query is introduced by a question mark in the generic URI syntax. In web applications it frequently carries search terms, filters or pagination parameters. The exact meaning belongs to the application rather than to the generic URI specification. A query string such as ?page=2&sort=date is often interpreted as named parameters, but the generic syntax does not require every query to use name-value pairs.
The fragment appears after a hash sign. Browsers may use it to navigate to a heading on a page or maintain application-specific state. The fragment is not generally part of the HTTP request target; it is handled by the client according to the representation type and application.
This distinction affects analytics and caching. Two URLs differing only by a fragment may result in the same document being requested, while a change in query parameters may produce a different server response. An application can override conventional behavior, so do not assume every query parameter always changes the content.
Sensitive tokens should not be casually placed in URLs. A URL can appear in browser history, logs, referrer information or screenshots, depending on security and navigation behavior. Fragment-based secrets also require careful design; simply placing a token after # does not make it automatically safe.
For website SEO, understand whether several parameterized URLs represent distinct pages or variations of one resource. Canonical choices should follow real content and search engine guidance, not a simplistic instruction to remove every query.
See our API explanation for common endpoint patterns. An API response depends on method, authentication and request body in addition to its URL.
URI Vs URL Vs URN Comparison Table
URI, URL and URN are overlapping historical and standards terms. A URI is the umbrella concept under RFC 3986. URL emphasizes an identifying reference that also provides location or access information, while URN refers to Uniform Resource Names under their namespace rules. Some modern web documentation uses URL almost exclusively for address handling.
| Term | Primary Emphasis | Illustrative Example |
|---|---|---|
| URI | Identifying A Resource | https://example.com/a |
| URL | Identifying With Location/Access | https://example.com/a |
| URN | Namespace-Based Naming | urn:isbn:9780131103627 |
| Relative Reference | Identification Using A Base | ../a or #chapter |
The common statement every URL is a URI but not every URI is a URL is a useful introductory simplification in the RFC 3986 terminology. It should not be used to infer that URI values can never have network location information or that one modern API must always distinguish the two programmatically.
Some protocols and programming libraries use a property called uri for an HTTP endpoint, while others name the same kind of property url. Read the documented meaning rather than trying to force an acronym-based validation rule on every interface.
The RFC’s terminology section explains why this historical distinction exists. The WHATWG standard clarifies the modern browser-oriented URL model.
For beginners, focus on recognizing scheme, host, path, query and fragment. This gives more practical value than memorizing a one-sentence slogan that ignores standards nuance.
How Browsers Parse And Normalize URLs
Browsers need interoperable rules for converting input strings into URLs, including whitespace, hostnames, relative references and special schemes. The WHATWG URL Standard specifies parsing and serialization algorithms used across the web platform. These algorithms can canonicalize certain representations so equivalent input strings produce consistent outputs.
For instance, a web URL may be serialized with a normalized hostname or standard treatment of default ports. That does not mean all text that looks like a URI will be accepted. An unsupported scheme or an input missing a required base may be rejected.
The browser’s address bar is not a general-purpose URI validator. It may interpret unrecognized text as a search query or add context that a programming API does not. This behavior can make a user think a malformed URL is valid because the browser eventually opened a search result.
Internationalized domain names add another layer. A host can contain Unicode input that the parser converts according to relevant domain-name rules. The displayed address may differ from the internal representation, and lookalike characters can create phishing risks.
Developers working with addresses should use tested URL APIs and separately enforce authorization and destination policy. A syntactically valid URL can still resolve to an unexpected or private network address. Parsing alone does not establish safety.
Our DNS guide explains the host-resolution stage, which is different from parsing. A parser can accept a host that DNS later cannot resolve or that no server is configured to serve.
Why URL And URI Validation Can Be A Security Issue
Untrusted URL input can cause more than a broken link. An application that fetches a user-supplied address may contact internal network services if its allowlist, DNS checks or redirect handling are poorly designed. This class of risk is commonly discussed as server-side request forgery, and it requires protections beyond a basic URL syntax check.
A safe design first defines what destinations and schemes are permitted. An image downloader might allow only HTTPS resources from approved external hosts, reject loopback and private destinations where necessary, and re-evaluate rules after redirects. The exact safeguards depend on the network and application threat model.
Open redirect bugs can occur when an application redirects users to arbitrary supplied URLs without appropriate checks. A trusted domain in the first part of an address can mislead a person if the actual host is hidden in a userinfo component or encoded confusingly.
Avoid checking for a trusted hostname only by searching whether its text appears somewhere in the complete URL. A path or query can contain arbitrary strings, while the actual host might be different. Use a parser and compare the parsed hostname against explicit policy.
Percent-decoding and Unicode normalization add more edge cases. A validator and a later network component must not disagree in a way that defeats security restrictions.
For broader device and network protection concepts, see what a firewall does. Proper URI handling is an application-layer control, not a substitute for network segmentation or authentication.
URL, URI And SEO Canonical Addresses
Websites can expose the same page through multiple URLs. Variations may involve trailing slashes, protocol schemes, hostnames or tracking parameters. Search engines attempt to understand which version represents the preferred resource, but site owners should make deliberate decisions using consistent linking, redirects and appropriate canonical metadata.
The URI/URL distinction does not directly determine ranking. A descriptive URL path can support clarity and navigation, while content quality, accessibility and correct technical signals matter far more than whether a developer calls the field uri or url.
A URL fragment usually targets a section of the current document, not a separate HTTP resource in the ordinary request. This is useful for internal table-of-contents links: #installation can navigate to a heading with that identifier. A malformed anchor that does not match a real element is a usability issue.
Our file extension guide explains why the end of a path does not guarantee a resource’s actual media type. A page URL ending with .html may be dynamically generated, while a clean path may return HTML or JSON according to content negotiation.
When moving a website, preserve important paths where practical and use correct redirects. Updating only visible navigation without checking old URLs can create broken internal links and search traffic loss.
The lasting lesson for publishers is to treat URLs as user-facing resource identifiers with stable, purposeful structures, not as arbitrary SEO keyword containers.
How To Use URLs Safely In Programming
In JavaScript, the standardized URL object can parse supported URLs and expose components such as protocol, hostname, pathname, search parameters and hash. For example, new URL("https://example.com/docs?lang=en") produces a structured object rather than requiring a hand-written regular expression.
When combining a relative reference with a base, use the two-argument form. The result can resolve dot segments and apply the platform’s serialization rules. Avoid manual concatenation that can create wrong paths or treat a query string as part of a hostname.
Do not confuse encodeURIComponent with encoding an entire URL. Encoding a component and serializing a full URL are different operations. Applying the wrong function at the wrong stage can double-encode delimiters or change server interpretation.
A backend language may expose a URI parser, URL parser and separate path utilities. Use each according to the documented input format. In particular, local filesystem paths are not universally equivalent to web URL paths, and their escaping requirements differ.
A robust workflow parses, validates allowed schemes and hosts, safely constructs parameters through the platform API and tests representative cases. Include relative links, fragments, non-ASCII characters and invalid inputs in those tests.
For a practical architectural context, see client server architecture. Correct address handling ensures the client contacts the intended resource; authentication and application correctness remain separate responsibilities.
Common URI And URL Mistakes
The most common misunderstanding is that every address-looking string is a full HTTPS URL. A relative path, mailto identifier and URN can all be valid within their respective contexts without containing a web hostname. Conversely, a string with https at the beginning can be malformed or misleading under the applicable parsing rules.
Another mistake is assuming that a URL’s fragment is always sent to the web server. In conventional HTTP navigation it is interpreted by the client. If an application uses fragment information for its own routing, the resulting behavior belongs to the application, not a rule that the fragment became an HTTP request header.
Developers may also treat percent encoding as encryption or assume that arbitrary decoding is harmless. It is neither. Incorrect interpretation of encoded delimiters can create security and routing problems.
A malformed base can change how a relative reference resolves. A link that works on the homepage may fail inside a nested route when the author assumed that a relative image path always begins from the domain root. Use consistent root-relative or properly resolved references when appropriate.
Finally, do not conclude that a valid URL is a trustworthy destination. Phishing links, compromised hosts and unexpected redirects can all use syntactically valid URLs.
For general technology terminology, see the XYZ Tech glossary. Precise names are valuable, but correct parsing, context and destination trust matter more than labels alone.
Frequently Asked Questions
What Is The Main Difference Between URI And URL?
URI is the broader resource identifier term, while URL traditionally emphasizes identification with location or access information.
Is Every URL Also A URI?
Under RFC 3986 terminology, ordinary URLs fall within the URI concept. Modern browser APIs generally use the term URL.
Is Every URI A Web Address?
No. A URI can use schemes other than HTTP or HTTPS, such as urn or mailto.
What Is A URN?
A Uniform Resource Name identifies a resource through a namespace, such as a defined ISBN-based identifier.
Is localhost A URL?
A complete address such as http://localhost:8000/ is a URL; the word localhost alone is a hostname, not necessarily a complete URL.
Does A URL Fragment Go To The Server?
In ordinary HTTP requests, the fragment is handled by the client and is not part of the request target.
Are URI And URL Validated The Same Way?
Not always. Generic URI rules and modern browser URL parsing have different definitions and algorithms.
Does A Valid URL Mean A Website Is Safe?
No. Syntax validity does not establish a trustworthy publisher, secure application or safe destination.



