August 6, 2026
DNS Tutorial: Domain Hierarchy, DNS Records, and Resolution Process
What is DNS?

By Zoya
2 min read
What is DNS?
The Domain Name System (DNS) is a simple way through which we can communicate with different devices on the internet without remembering their IP addresses. Every device on the internet has its own unique IP address for communication. An IP address looks like this: 104.26.10.229 — four sets of numbers ranging from 0 to 255, separated by periods.
DNS translates human-readable website names (such as google.com) into machine-readable IP addresses. It operates over both TCP and UDP protocols and uses a distributed hierarchical database.
Domain Hierarchy
Root Domain → Top-Level Domain → Second-Level Domain
Top-Level Domain (TLD)
A Top-Level Domain (TLD) is the rightmost part of a domain name. For example, in google.com, .com is the TLD.
There are two main types of TLDs:
- gTLD (Generic Top-Level Domain): These provide general information about the website. For example, .com is commonly used for commercial websites, while .org is generally used by organizations.
- ccTLD (Country Code Top-Level Domain): These represent specific countries or regions. For example, .co.uk is commonly used for websites based in the United Kingdom.
Second-Level Domain
Taking google.com as an example, .com is the TLD, while google is the second-level domain.
When registering a domain name, the second-level domain is limited to 63 characters (excluding the TLD). It can contain only letters (a–z), numbers (0–9), and hyphens (-). It cannot start or end with a hyphen or contain consecutive hyphens.
Subdomain
A subdomain sits to the left of the second-level domain and is separated by a period (.). For example, in admin.google.com, admin is the subdomain.
A subdomain follows the same naming restrictions as a second-level domain. You can create multiple subdomains for a single domain, and there is no fixed limit on the number of subdomains. However, the total length of a fully qualified domain name (FQDN) must not exceed 253 characters.
DNS Record Types
A Record
These records resolve a domain name to an IPv4 address, for example:
104.26.10.229
AAAA Record
These records resolve a domain name to an IPv6 address, for example:
2606:4700:20::681a:be5
CNAME Record
A CNAME (Canonical Name) record points one domain name to another domain name.
For example, store.google.com may return a CNAME record pointing to shops.shopify.com. Another DNS request is then made to shops.shopify.com to obtain its IP address.
MX Record
MX (Mail Exchange) records specify the mail servers responsible for receiving emails for a domain.
For example, an MX record for google.com might return alt1.aspmx.l.google.com.
MX records also include a priority value, which tells email clients the order in which mail servers should be used. If the primary mail server becomes unavailable, emails can be delivered to a backup server.
TXT Record
TXT records store text-based information and are commonly used for domain verification, email authentication, and security.
Some common examples include:
_acme-challenge.example.com TXT "token_value_here"@ TXT "v=spf1 ip4:192.0.2.0/24 include:_spf.google.com include:amazonses.com ~all"_dmarc.example.com TXT "v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com; adkim=s; aspf=s; pct=100"@ TXT "MS=ms12345678"
How DNS Works
- User Request: You type a website address into your browser.
- Recursive Resolver: Your computer sends a request to a recursive resolver (such as your ISP's DNS server or a public DNS service) to find the IP address.
- Root Server: The resolver queries the root DNS server to determine which Top-Level Domain (TLD) server to contact.
- TLD Server: The request is forwarded to the appropriate TLD server (such as .com or .org).
- Authoritative DNS Server: The authoritative DNS server returns the correct IP address for the requested domain.
- Response: The resolver sends the IP address back to your browser, which then connects to the website.