Understanding URLs

Published - 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

Example:

References