Domain Name
A domain name is used to give a server a name that is easier to remember than an IP address. A domain (the 'name' part is often omitted) can be bought from a domain name registrar. You can configure a DNS record for a domain. This means the DNS server of the registrar lists a new entry for your domain and your servers IP address. Common DNS records are: A (address), CNAME or ALIAS.
Here is an example of an URL and the different pieces explained:
https://www.roadmappy.com/maps/overview
https://
the protocol HTTP is used (other protocols are file:///
or ftp://
).
www.
subdomain (no every URL has a subdomain)
roadmappy
Second-level domain
.com
Top level domain
/maps/overview
pathname
www.roadmappy.com
hostname
Sometimes you see also the usage of a subdomain (for example: the mobile variant of a website, or a localized version or an app)
https://de.wikipedia.org/
(de.
localized German version of Wikipedia)
https://old.reddit.com/
(old.
old reddit user interface is still available via the subdomain)
https://books.google.de/
(book.
)
- there is no limit to possible subdomain names...
Further Reading
https://developer.mozilla.org/en-US/docs/Web/API/Location
https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL