Domain Names

Human-readable text strings that act as aliases for numerical IP addresses.

Internet3 min readConcept 4 of 6

What is a Domain Name?

While computers require numerical IP addresses (like 142.250.190.46) to locate each other, humans are terrible at memorizing random numbers.

A **Domain Name** (like google.com) is a human-readable alias that sits on top of an IP address. It acts as an easy-to-remember shortcut so you don't have to memorize strings of numbers.

Why Developers Need It

Beyond just making websites accessible to humans, domain names dictate browser security.

Browsers enforce the **Same-Origin Policy** and **CORS** based on domains. A script running on api.yoursite.com cannot automatically access data on app.yoursite.com without explicit permission, because the browser treats different subdomains as completely separate origins.

The Domain Hierarchy

Domain names are read from right to left, moving from the broadest category to the most specific.

**1. TLD (Top-Level Domain):** The furthest right section (e.g., .com, .org, .dev). These are managed by a global organization called ICANN.

**2. Second-Level Domain:** The main brand name you buy (e.g., google in google.com).

**3. Subdomain:** The prefix added to the left (e.g., www, api, blog). You can create infinite subdomains for free once you own the second-level domain.

Domain Dissector

Tap the different parts of the URL below to dissect and understand the anatomical structure of a web address.

// Anatomy of a URL const url = new URL("https://api.github.com/users"); console.log(url.protocol); // "https:" console.log(url.hostname); // "api.github.com" console.log(url.pathname); // "/users" // Note: Subdomain and TLD extraction requires // parsing the hostname string manually!
Tap to Dissect URL
https://api.github.com/users
Select any part of the URL above.
Protocol / Scheme
Tells the browser how to connect. Usually HTTPS (secure) or HTTP (unsecure) for the web.
Subdomain
An optional prefix to logically divide a site (e.g., separating the 'api' from the 'www' frontend).
Second-Level Domain
The core brand name that you actually register and buy.
Top-Level Domain (TLD)
The most generic suffix (.com, .org, .dev). Browsers read domains right-to-left, starting here!
Path
The specific folder or resource being requested on the server once the domain is reached.

Check yourself

Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.

  1. 1What is the primary purpose of a Domain Name?
  2. 2In the address 'blog.yoursite.com', what does 'blog' represent?
  3. 3What is the difference between a Domain Name and a URL?

Remember this

  • Domain names are human-readable aliases for IP addresses.
  • Domains are read from right to left, getting more specific (TLD -> Second-Level -> Subdomain).
  • A Domain Name is just one component of a full URL.

Done with this concept?

Mark it complete to track your progress. No login needed.