DNS Explained: How Your Browser Decodes Website Addresses

You type www.google.com and hit Enter. The page loads instantly.

Your browser does not know where Google lives. It must ask. A fast chain of lookups happens in milliseconds. This system is the Domain Name System (DNS).

Think of DNS as the internet phonebook. It translates names like www.google.com into IP addresses like 142.250.80.46. Without it, you would need to memorize numbers for every website.

How the lookup works:

Domain structure:

  • Subdomain: a section of the site (e.g., www)
  • Second-Level Domain: the brand name (e.g., google)
  • Top-Level Domain (TLD): the category or country (e.g., .com)

Before searching the web, your computer checks two places:

  • Browser cache: If you visited the site recently, the IP is already stored.
  • Hosts file: A local file on your computer used for manual mappings.

If those fail, the Recursive Resolver takes over. This is usually provided by your ISP. You can use faster options like Google (8.8.8.8) or Cloudflare (1.1.1.1).

The Resolver follows this hierarchy:

  • Root Server: Directs the resolver to the correct TLD server.
  • TLD Server: Directs the resolver to the specific Authoritative Name Server.
  • Authoritative Name Server: Holds the actual IP address and sends it back.

The Resolver then saves this answer for a set time. This time is called TTL (Time To Live). High TTL means faster repeats. Low TTL helps when you change servers quickly.

Common DNS record types:

  • A: Maps domain to IPv4 address.
  • AAAA: Maps domain to IPv6 address.
  • CNAME: Creates an alias to another domain.
  • MX: Directs email to the right server.
  • TXT: Holds text for verification or security.

DNS queries are normally plain text. This means your ISP can see them. You can use DNS over HTTPS (DoH) or DNS over TLS (DoT) to encrypt this data for better privacy.

DNS is the invisible foundation of the web. Understanding it helps you debug deployment delays and server migrations.

Source: https://dev.to/jinkrish/dns-explained-how-your-browser-decodes-website-addresses-2bcm