Back to all articles

DNS Lookup Guide: How to Perform DNS Queries and Check DNS Records

February 2, 2026
By DNS Expert
DNS LookupToolsTroubleshooting

What is a DNS Lookup?

A DNS lookup (also called DNS resolution or DNS query) is the process of querying DNS servers to find the IP address associated with a domain name or to retrieve other DNS record information.

DNS lookups are essential for:

  • Troubleshooting website connectivity issues
  • Verifying DNS configuration changes
  • Checking mail server settings
  • Security and domain investigation
  • Performance optimization

How to Perform a DNS Lookup

Method 1: Using nslookup (Windows, Mac, Linux)

nslookup is a built-in command-line tool available on most operating systems.

Basic Usage:

nslookup example.com

Output example:

Server:    8.8.8.8
Address:   8.8.8.8#53

Non-authoritative answer:
Name:   example.com
Address: 93.184.216.34

Query specific DNS server:

nslookup example.com 8.8.8.8

Query specific record type:

nslookup -type=MX example.com

Method 2: Using dig (Mac, Linux)

dig (Domain Information Groper) is a more powerful DNS lookup tool preferred by advanced users.

Basic Usage:

dig example.com

Query specific record type:

dig example.com A
dig example.com AAAA
dig example.com MX
dig example.com TXT

Short answer format:

dig example.com +short

Trace the complete DNS resolution path:

dig example.com +trace

Method 3: Using host Command

A simple alternative on Unix-based systems:

host example.com
host -t MX example.com

Method 4: Online DNS Lookup Tools

Several websites offer DNS lookup functionality without requiring command-line access:

  • Google DNS: Quick and simple
  • MXToolbox: Comprehensive DNS testing
  • WhatsMyDNS: Global DNS propagation checker
  • DNSChecker: Multiple DNS record queries

Understanding DNS Lookup Results

A Record Lookup

Shows the IPv4 address of a domain:

dig example.com A +short
93.184.216.34

AAAA Record Lookup

Shows the IPv6 address:

dig example.com AAAA +short
2606:2800:220:1:248:1893:25c8:1946

MX Record Lookup

Shows mail servers for the domain:

dig example.com MX +short
10 mail.example.com.

The number (10) is the priority - lower numbers have higher priority.

TXT Record Lookup

Shows text records (often used for domain verification and SPF):

dig example.com TXT +short
"v=spf1 include:_spf.example.com ~all"

NS Record Lookup

Shows the authoritative nameservers:

dig example.com NS +short
ns1.example.com.
ns2.example.com.

CNAME Record Lookup

Shows domain aliases:

dig www.example.com CNAME +short
example.com.

Common DNS Lookup Scenarios

1. Check if DNS Changes Have Propagated

After changing DNS records, use multiple DNS servers to verify propagation:

dig example.com @8.8.8.8 +short
dig example.com @1.1.1.1 +short
dig example.com @208.67.222.222 +short

2. Troubleshoot Email Delivery Issues

Check MX records to verify mail server configuration:

dig example.com MX

3. Verify Domain Ownership

Check TXT records for verification tokens:

dig example.com TXT

4. Find the DNS Server Being Used

On Windows:

ipconfig /all

On Mac/Linux:

cat /etc/resolv.conf

5. Reverse DNS Lookup

Find the domain name associated with an IP address:

nslookup 8.8.8.8
dig -x 8.8.8.8

DNS Lookup Response Codes

Understanding response codes helps troubleshoot issues:

  • NOERROR: Successful query
  • SERVFAIL: Server failed to complete the query
  • NXDOMAIN: Domain doesn't exist
  • REFUSED: Server refused to answer
  • TIMEOUT: No response from DNS server

Advanced DNS Lookup Techniques

Query Authoritative Nameserver Directly

Bypass caching by querying the authoritative nameserver:

# First, find the authoritative nameserver
dig example.com NS +short

# Then query it directly
dig @ns1.example.com example.com

Check DNS Propagation Globally

Use online tools or query DNS servers in different regions:

# Query DNS servers from different countries
dig example.com @8.8.8.8  # Google (US)
dig example.com @1.1.1.1  # Cloudflare (Global)
dig example.com @9.9.9.9  # Quad9 (Global)

Flush DNS Cache

Sometimes you need to clear your local DNS cache:

Windows:

ipconfig /flushdns

Mac:

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Linux:

sudo systemd-resolve --flush-caches

DNS Lookup Best Practices

  1. Use Multiple DNS Servers: Check against Google DNS, Cloudflare, and your ISP
  2. Wait for Propagation: DNS changes can take 24-48 hours globally
  3. Check TTL Values: Lower TTL before making changes for faster propagation
  4. Document Changes: Keep records of DNS modifications
  5. Test Before Going Live: Verify DNS configuration before pointing domains

Troubleshooting Common DNS Issues

Issue: Domain Not Resolving

Solutions:

  1. Check if domain is registered and not expired
  2. Verify nameserver configuration
  3. Wait for DNS propagation (24-48 hours)
  4. Try different DNS resolvers
  5. Check for DNSSEC issues

Issue: Slow DNS Resolution

Solutions:

  1. Switch to faster public DNS servers (1.1.1.1, 8.8.8.8)
  2. Check network connectivity
  3. Flush local DNS cache
  4. Verify router DNS settings

Issue: Intermittent Resolution

Solutions:

  1. Check for DNS server outages
  2. Verify redundant nameservers are configured
  3. Test with dig +trace to identify failing server
  4. Check firewall/security software

Conclusion

DNS lookup is an essential skill for anyone managing websites, email servers, or troubleshooting network issues. Whether you use command-line tools like dig and nslookup or online services, understanding DNS queries helps you maintain reliable internet services.

Remember:

  • Use the right tool for your needs
  • Understand what each DNS record type represents
  • Be patient with DNS propagation
  • Keep documentation of your DNS configuration

Related Articles: