Skip to content

Understanding URLs

Published Updated 1 min read

A URL is a string that identifies a resource on the web, and is the most common type of URI.

URL Structure

The following interactive URL explorer breaks down the components of a URL.

Schemehttps
://
User Infouser:pass
@
Hostapi.example.com
:
Port8080
Path/path/to/resource
?
Queryquery=string
#
Fragmentsection

Components

  1. Scheme: Defines the protocol (e.g., https, ftp, mailto)
  2. User Information: Optional authentication credentials (rarely used today)
  3. Host: Domain name or IP address
  4. Port: Optional port number (e.g., :443 for HTTPS)
  5. Path: Resource location on the server
  6. Query String: Optional key-value pairs after ?
  7. Parameters: Each key-value pair separated by ’&’
  8. Fragment: Optional anchor or section identifier after #
  9. Authority: Combination of user info, host, and port
  10. Hierarchical Part: Everything between scheme and query
  11. Resource: Everything after the authority

URL vs URI

  • URI (Uniform Resource Identifier): The broader category that includes both URLs and URNs, as defined in RFC 3986
  • URL (Uniform Resource Locator): Specifies how to access a resource and where to find it, as defined in RFC 3986
  • URN (Uniform Resource Name): Names a resource without specifying how to access it, as defined in RFC 2141

Example:

  • URI: urn:isbn:0-486-27557-4 (identifies a book by ISBN)
  • URL: https://example.com/books/123 (locates a specific resource)
  • URN: urn:example:book:123 (names a book by its identifier)

References