Uniform Resource Identifier (URI)

A Uniform Resource Identifier (URI) is a sequence of characters used to identify a resource. Resources are distinguished by their location on the internet, their name, or both.

There are two types of URI: the Uniform Resource Locator (URL) and Uniform Resource Name (URN).

URLs and URNs

A URI identifies physical or logical resources available on the web. Resources include web pages and electronic documents, but also people, places, objects, and abstract concepts.

A URI specifying the location of a resource is a Uniform Resource Locator (URL). A URI providing a persistent name without location details is a Uniform Resource Name (URN).

Every URL is a URI, and every URN is a URI. The terms overlap because URI is the umbrella category.

Note

The specification discourages treating URL and URN as distinct subsets. In practice, the term URI covers both and is the preferred technical designation.

Syntax

The generic URI syntax follows this structure:

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

Scheme

A required component naming the protocol or naming system. The scheme is case-insensitive, begins with a letter, and continues with any mix of letters, digits, plus +, hyphen -, or period .. Common schemes include http, https, ftp, mailto, and urn. IANA maintains the official URI schemes registry.

Authority

An optional component prefixed by two slashes //. The authority contains up to three sub-components:

  • Userinfo: optional username (and deprecated password), followed by @. The username:password form is deprecated for security reasons.
  • Host: a registered domain name or IP address. IPv6 addresses are enclosed in brackets [ ].
  • Port: optional, preceded by a colon :.

Path

A required component made up of segments separated by /. The path is required for every URI but its value is allowed to be empty (zero-length). A path with an authority always starts with /.

Query

An optional component prefixed by ?. The query string passes data or instructions to the resource, using a format expected by the server.

Fragment

An optional component prefixed by #. The fragment identifies a secondary resource or a specific part of the primary resource. Fragments are resolved on the client side and are never sent to the server in an HTTP request.

Percent-encoding

Characters outside the allowed set are represented using Percent-Encoding. Each encoded character uses a percent sign % followed by two hexadecimal digits representing the octet value. Reserved characters with special meaning in the URI syntax (:, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, =) are percent-encoded when they appear in a component where they have no reserved purpose.

Relative references

A URI reference is either a full URI or a relative reference. Relative references omit the scheme and resolve against a base URI to produce a target URI. This allows document trees to remain portable across different locations and access schemes.

../images/logo.png

Given a base URI of https://example.re/docs/guide/index.html, the relative reference above resolves to https://example.re/docs/images/logo.png.

Examples

A full HTTP URI with scheme, authority, path, and fragment:

Example 1

http://www.example.re/doc/glossary#introduction
Component Value
Scheme http
Authority www.example.re
Path /doc/glossary
Fragment introduction

An HTTPS URI with port, path, query, and fragment:

Example 2

https://example.re:5001/scripts/?job=111&task=1#main
Component Value
Scheme https
Authority example.re
Port 5001
Path /scripts/
Query job=111&task=1
Fragment main

A telephone URI with no authority. The tel scheme uses only a scheme and path:

Example 3

tel:+1-212-555-1212
Component Value
Scheme tel
Path +1-212-555-1212

An FTP URI pointing to a specific file:

Example 4

ftp://ftp.example.re/doc/glossary.pdf
Component Value
Scheme ftp
Authority ftp.example.re
Path /doc/glossary.pdf

Takeaway

A Uniform Resource Identifier (URI) uniquely identifies a resource by location, name, or both. A URI specifying a location is a URL, and one assigning a persistent name is a URN.

See also

Last updated: March 6, 2026