URL Syntax and Name of Parts

By Xah Lee. Date: .

Here is a visual review about URL parts.



Protocol specify a web protocol to use.

Sample values:

  • http
  • https
  • ftp

[see HTTP Protocol Tutorial]

Host specify a machine to connect to.

Sample value: www.example.com

The example.com is domain name. www is sub-domain.

Port Number
Port Number is a integer that is similar to a number of a street address.
  • HTTP protocol default to port 80.
  • HTTPS protocol default to port 443.
Resource Path
Path specifies a specific document.

Sample value: a/b/c

Query String
A list of key/value pairs, separated by & (U+26: AMPERSAND)

Sample value: x=1&y=2

URL Fragment
Used for jumping to specific section of current page. Value is typically alphanumeric.

Sample value: some

JavaScript/DOM, Get/Set URL

BUY Ξ£JS JavaScript in Depth