DNS (Domain Name System) is the internet's distributed directory service that translates human-readable domain names like example.com into machine-readable IP addresses like 93.184.216.34. Without DNS, users would need to memorize numeric addresses to reach any website or service.
DNS is a hierarchical, distributed database that maps domain names to IP addresses and other resource records. It functions like a phone book for the internet, allowing browsers and applications to locate servers by name rather than address. The system is globally distributed across millions of servers to ensure speed, redundancy, and scalability.
DNS is organized in a tree structure starting at the root zone, followed by Top-Level Domains (TLDs) like .com or .org, then second-level domains like example.com, and optionally subdomains like www.example.com. Each level is managed by different authoritative name servers. ICANN oversees the root zone, while registrars manage individual domain registrations.
When you type a domain into a browser, your OS first checks its local cache, then queries a recursive resolver (usually provided by your ISP or a public service like 8.8.8.8). The resolver walks the hierarchy: it asks a root name server, which directs it to the TLD name server, which directs it to the authoritative name server for the domain. The authoritative server returns the final answer, such as an A record containing the IPv4 address.
DNS stores different types of resource records for different purposes. A records map a hostname to an IPv4 address, AAAA records map to IPv6, CNAME records create aliases pointing to another hostname, MX records define mail servers, and TXT records store arbitrary text often used for SPF, DKIM, and domain verification. NS records specify which servers are authoritative for a zone.
Every DNS record has a Time-To-Live (TTL) value in seconds that controls how long resolvers and clients may cache the answer before querying again. Lower TTLs allow faster propagation of changes but increase query load on authoritative servers. When changing DNS records, it is best practice to lower the TTL well in advance so the transition is fast and stale cached values expire quickly.
DNS changes do not propagate worldwide instantly because of caching at multiple layers including resolvers, OS caches, and browser caches. Even after updating a record at your registrar, old answers can persist until every cached copy's TTL expires. Always pre-reduce your TTL before planned migrations, and use tools like dig or nslookup to query specific authoritative servers directly to verify changes independently of your local cache.
© RM Full Stack & AI Engineer · All guides · Roadmaps · Open the app