XiaTools

What Is a DNS Lookup and How Do You Perform One?

By Rohit, founder of XiaTools · Updated 23 Oct 2026

A DNS lookup is the process of querying a Domain Name System server to translate a human-readable hostname, such as example.com, into a machine-readable IP address. This foundational network request occurs billions of times every second, acting as the digital phonebook that connects your browser to the correct web server. Without DNS lookups, you would have to memorize complex numerical addresses for every website you wish to visit.

To quickly check the DNS records for any domain from your browser, you can use the XiaTools DNS Lookup tool, which queries global nameservers instantly without requiring command-line access.

Understanding How a DNS Lookup Works

When you type a URL into your address bar, your operating system, local router, and Internet Service Provider execute a carefully orchestrated multi-step resolution process. Understanding this workflow helps you troubleshoot website downtime, mail delivery failures, and propagation delays.

The Step-by-Step Resolution Process

  1. Browser Cache Check: Your browser checks its internal cache to see if it has visited the domain recently and remembers the associated IP address.
  2. Operating System Cache: If the browser cache misses, the OS checks its own local DNS cache.
  3. Recursive Resolver: If local caches fail, the query goes to your recursive resolver, typically managed by your ISP or a public provider like 1.1.1.1 or 8.8.8.8.
  4. Root Nameservers: If the resolver doesn't have the record cached, it asks one of the 13 global root nameservers, which directs it to the appropriate Top-Level Domain (TLD) nameserver (such as .com or .org).
  5. TLD Nameserver: The TLD server points the resolver to the authoritative nameservers responsible for the specific domain.
  6. Authoritative Nameserver: The authoritative server holds the actual record (like an A record pointing to 192.0.2.1) and returns it to the resolver, which caches it and hands it back to your device.

Common DNS Record Types

During a DNS lookup, you can request various record types depending on what information you need:

Record Type Purpose Example Value
A Maps a domain to an IPv4 address 192.0.2.1
AAAA Maps a domain to an IPv6 address 2001:db8::1
CNAME Aliases one domain name to another ghs.google.com
MX Specifies mail servers for email delivery mail.example.com (Preference 10)
TXT Holds text data for SPF, DKIM, and verification v=spf1 include:_spf.example.com ~all
NS Identifies authoritative nameservers for a zone ns1.example.com

How to Perform a DNS Lookup

Network administrators and developers rely on command-line utilities to perform DNS lookups directly against specific resolvers. This level of control allows you to bypass local caching and verify live records.

Using dig on Linux and macOS

The dig (Domain Information Groper) utility is the industry standard for querying DNS name servers.

To perform a basic A record lookup for a domain, open your terminal and run:

dig example.com

Sample output:

; <<>> DiG 9.10.6 <<>> example.com
;; global options: +cmd
;; Got answer:
;; -> \*\*Header\*\* opcode: QUERY, status: NOERROR, status: 3
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;;	example.com.		IN	A

;; ANSWER SECTION:
example.com.		IN	A	192.0.2.1

;; Query status: response time: 14 ms
;; Query server: 192.0.2.53

If you want to query a specific nameserver, such as a public resolver, use the @ symbol:

dig @1.1.1.1 example.com TXT

Using PowerShell on Windows

Windows administrators use the Resolve-DnsName cmdlet in PowerShell to query domain records.

Resolve-DnsName -Name example.com -Type A

Sample output:

Name                            Type   TTL   Section   IPAddress
----                            ----   ---   -------   ---------
example.com                     A      3600  Answer    192.0.2.1

To query MX records in PowerShell, update the type parameter:

Resolve-DnsName -Name example.com -Type MX

Using nslookup Across Platforms

nslookup works across Windows, macOS, and Linux for quick interactive or single-line queries:

nslookup -type=mx example.com

DNS Lookup Checklist for Troubleshooting

When a domain fails to resolve correctly, walk through this quick checklist to isolate the issue:

  • Flush your local operating system DNS cache (ipconfig /flushdns on Windows, or sudo dscacheutil -flushcache on macOS).
  • Perform a direct query against an authoritative nameserver to bypass propagation lag.
  • Verify that TTL (Time To Live) settings are appropriately low before making a planned IP migration.
  • Check for syntax errors in TXT records, particularly SPF and DMARC strings.
  • Confirm that your domain registrar points to the correct nameserver hostnames.

Common Mistakes and How to Fix Them

Mistake 1: Expecting Instant Global Propagation

When you update an A record at your DNS provider, users around the world may still see the old IP address. This happens because previous resolvers have cached the record based on its TTL value.

  • The Fix: Lower your TTL to 300 seconds (5 minutes) at least 24 hours before making any planned server migration. Once the migration is complete, you can raise the TTL back to standard values like 86400 seconds (24 hours).

Mistake 2: Confusing CNAME and Apex Records

A common error is applying a CNAME record to a root domain (apex domain, such as example.com). DNS standards prevent apex domains from having CNAME records because they conflict with mandatory SOA and MX records.

  • The Fix: Use standard A and AAAA records for your root domain, or utilize an alias/ANAME record feature if your DNS provider supports it. Reserve CNAME records exclusively for subdomains like www.example.com or blog.example.com.

Mistake 3: Querying the Wrong Resolver During Testing

When troubleshooting an internal DNS change, testing through your default ISP resolver might return stale cached data.

  • The Fix: Explicitly target public recursive resolvers like 8.8.8.8 or 1.1.1.1, or query the domain's authoritative nameservers directly using tools like dig @ns1.example.com example.com.

Frequently asked questions

What is the difference between an A record and a CNAME record?

An A record directly maps a hostname to a 32-bit IPv4 address, whereas a CNAME record maps a hostname to another domain name. You use CNAME records when you want multiple subdomains to point to a single canonical destination.

Why do my DNS changes take up to 48 hours to update globally?

Global update delays occur because intermediate recursive resolvers and local operating systems cache DNS records according to their designated TTL (Time to Live). Once the cached TTL expires, resolvers query the authoritative nameserver again to fetch the updated information.

Can I perform a DNS lookup without using the command line?

Yes. You can use web-based diagnostic utilities like the XiaTools DNS Lookup tool to query various DNS record types instantly from any web browser without needing terminal commands.

What is an authoritative nameserver?

An authoritative nameserver is the ultimate source of truth for a domain's DNS records. It is managed by your DNS hosting provider or administrator and holds the official records that recursive resolvers query when their local cache expires.

How do I flush my local DNS cache?

On Windows, open Command Prompt or PowerShell and run `ipconfig /flushdns`. On macOS, run `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder` in your terminal window.

Related articles

Free tools