A DNS lookup is one of the most useful diagnostic methods for website owners, system administrators, developers, cybersecurity professionals, and anyone responsible for managing a domain name.
Whenever you enter a domain such as example.com into a browser, the Domain Name System translates that human-readable name into an IP address that computers can use. However, DNS does much more than connect domains to web servers. It also controls email delivery, domain verification, subdomains, nameservers, security policies, service discovery, and many other internet functions.
Performing a DNS lookup allows you to view this information and determine whether a domain is configured correctly.
You can check DNS records in two primary ways:
- Using an online DNS lookup tool
- Running a DNS lookup command from a terminal or command prompt
Both methods can return valuable information, but they are useful in different situations. Online tools are generally faster and easier for occasional checks, while command-line utilities provide more control and deeper diagnostic capabilities.
This guide explains how DNS lookups work, which DNS records you can query, how to use popular command-line tools such as nslookup, dig, host, and Resolve-DnsName, and how online DNS lookup tools compare with terminal-based methods.
What Is a DNS Lookup?
A DNS lookup is the process of querying the Domain Name System to retrieve information associated with a domain name, hostname, or IP address.
The most common DNS lookup translates a domain name into an IPv4 or IPv6 address. For example, a DNS query for example.com may return an IPv4 address through an A record or an IPv6 address through an AAAA record.
However, DNS lookups can retrieve many other types of information, including:
- The mail servers responsible for receiving email
- The authoritative nameservers for a domain
- Domain ownership or verification information stored in TXT records
- Aliases created through CNAME records
- Email security policies such as SPF, DKIM, and DMARC
- Service locations defined in SRV records
- Reverse DNS hostnames associated with IP addresses
- DNSSEC-related records used to verify DNS authenticity
A DNS lookup can therefore help you investigate website availability, email delivery problems, domain verification failures, DNS propagation, incorrect nameserver settings, and possible security issues.
How Does a DNS Lookup Work?
When your browser or another application needs to connect to a domain, it usually asks a recursive DNS resolver to find the required record. A simplified DNS resolution process works as follows:
- Your device checks its local DNS cache.
- Your operating system checks whether the hostname exists in a local hosts file.
- The query is sent to a recursive DNS resolver.
- The resolver checks its own cache.
- If the answer is not cached, the resolver contacts a root DNS server.
- The root server directs it to the appropriate top-level domain server, such as the server responsible for
.com. - The top-level domain server identifies the domain’s authoritative nameservers.
- The resolver queries an authoritative nameserver.
- The authoritative server returns the requested DNS record.
- The resolver caches the response according to its Time to Live value and returns it to the user.
This entire process often completes in milliseconds. When you use an online DNS lookup tool or command-line utility, you are manually requesting some of the same DNS information.
What Information Can You Find with a DNS Lookup?
The information returned depends on the DNS record type you request. Understanding the most common record types makes DNS results much easier to interpret.
A Record
An A record maps a domain or hostname to an IPv4 address.
example.com. 3600 IN A 192.0.2.10
In this result, example.com is the queried domain, 3600 is the TTL in seconds, IN identifies the internet record class, A is the record type, and 192.0.2.10 is the IPv4 address. A records are commonly used for websites, APIs, control panels, and other internet services.
AAAA Record
An AAAA record maps a hostname to an IPv6 address.
example.com. 3600 IN AAAA 2001:db8::10
A website can have both A and AAAA records, allowing users to connect over either IPv4 or IPv6.
CNAME Record
A CNAME record makes one hostname an alias of another hostname.
www.example.com. 3600 IN CNAME example.com.
This record indicates that www.example.com should resolve through example.com. CNAME records are frequently used for content delivery networks, hosted applications, verification services, and third-party platforms.
MX Record
An MX record identifies the mail servers responsible for accepting email for a domain.
example.com. 3600 IN MX 10 mail.example.com.
The number before the mail server is the priority value. Lower values normally have higher priority. A domain may have multiple MX records for redundancy. MX lookups are essential when troubleshooting rejected, delayed, or undelivered email.
TXT Record
TXT records store text-based information associated with a domain. They are commonly used for SPF email authorization, DKIM public keys, DMARC policies, Google and Microsoft service verification, certificate authority validation, domain ownership confirmation, and security policies.
Example SPF record:
example.com. 3600 IN TXT "v=spf1 include:_spf.example.net -all"
Because a domain can have multiple TXT records, you should carefully inspect every value returned.
NS Record
NS records identify the authoritative nameservers responsible for a domain’s DNS zone.
example.com. 86400 IN NS ns1.example.net.
example.com. 86400 IN NS ns2.example.net.
If the NS records configured at the domain registrar do not match the intended DNS provider, the domain may fail to resolve correctly.
SOA Record
The Start of Authority record contains administrative information about a DNS zone, including the primary authoritative nameserver, the responsible administrator, the zone serial number, refresh interval, retry interval, expiration value, and negative caching TTL. SOA lookups are particularly useful when comparing zone versions across authoritative nameservers.
PTR Record
A PTR record performs the opposite function of an A or AAAA record. Instead of mapping a hostname to an IP address, it maps an IP address to a hostname. This process is known as a reverse DNS lookup. PTR records are especially important for mail servers, as many receiving systems evaluate reverse DNS when deciding whether an email server is trustworthy.
CAA Record
A Certification Authority Authorization record specifies which certificate authorities are permitted to issue SSL/TLS certificates for a domain.
example.com. 3600 IN CAA 0 issue "letsencrypt.org"
CAA records can reduce the risk of unauthorized certificate issuance.
Why Would You Need to Perform a DNS Lookup?
You may need a DNS lookup when a website is not loading, a domain is pointing to the wrong server, a newly created subdomain is not working, email messages are being rejected, an SPF or DMARC record is not detected, a domain verification process is failing, you recently changed hosting providers or updated nameservers, you need to confirm whether DNS changes are visible, you want to compare answers from multiple DNS resolvers, you suspect a DNS cache problem, or you need to identify the authoritative DNS provider.
A DNS lookup is often the first step in diagnosing a website or email problem because it shows where internet traffic is being directed.
Method 1: Using an Online DNS Lookup Tool
An online DNS lookup tool allows you to query DNS records directly from a web browser. You enter a domain, choose a record type, and receive the results without installing software or opening a terminal.
nslookup.net provides a free online DNS lookup tool that queries authoritative nameservers in real time. You can check any DNS record type — A, AAAA, MX, NS, TXT, CNAME, SOA, CAA, and more — for any domain, with results typically returned in under a second.
How to Use an Online DNS Lookup Tool
- Open nslookup.net/tools/dns-record-lookup in your browser.
- Enter the domain or hostname you want to check.
- Select a DNS record type, such as A, AAAA, MX, TXT, NS, CNAME, or SOA.
- Click “Look Up” and review the returned records, TTL values, hostnames, and IP addresses.
For example, entering example.com and choosing the MX record type will return the domain’s email server configuration. If you suspect an email delivery problem, you can also use the dedicated MX lookup tool at nslookup.net/tools/mx-lookup.
Advantages of Online DNS Lookup Tools
No installation required. Online tools work directly in a browser, accessible from Windows, macOS, Linux, Android, iOS, and most other internet-connected devices.
Easy record selection. Instead of remembering command-line parameters, users can select a record type from a list.
Clearer results. Many online tools organize results into readable tables and label values such as record type, hostname, TTL, priority, and destination.
Remote resolver perspective. An online lookup is performed from an external server rather than your own computer. This can help determine whether a DNS problem is local to your device or visible publicly.
Useful for mobile devices. Running terminal commands on a smartphone may be inconvenient. A browser-based DNS checker is generally faster.
Limitations of Online DNS Lookup Tools
Online tools may use only one DNS resolver, may return cached information, may not allow querying a specific nameserver, and may not show the complete DNS response. For these situations, command-line tools provide more control.
Method 2: Performing a DNS Lookup from the Command Line
Command-line DNS tools provide more control over the query. They allow you to select a record type, query a specific DNS resolver, inspect response flags, perform reverse lookups, trace delegation, and troubleshoot DNS caching or authority problems. The most common tools are nslookup, dig, host, and Resolve-DnsName.
How to Use nslookup
nslookup is included with Windows and is also available on macOS and Linux.
Basic nslookup Command
nslookup example.com
A typical response shows the DNS resolver that answered and the returned IP address. A “non-authoritative answer” means the response came from a recursive resolver or its cache rather than directly from the domain’s authoritative nameserver — this is normal for most lookups.
Querying a Specific Record Type
nslookup -type=MX example.com
nslookup -type=NS example.com
nslookup -type=TXT example.com
nslookup -type=SOA example.com
nslookup -type=AAAA example.com
Querying a Specific DNS Server
nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1
Comparing several resolvers can help identify cached or inconsistent DNS responses.
Reverse DNS Lookup with nslookup
nslookup 192.0.2.10
You can also use the reverse DNS lookup tool at nslookup.net/tools/reverse-dns-lookup for a faster result with no terminal required.
How to Use dig
dig (Domain Information Groper) is one of the most powerful DNS diagnostic utilities, widely used by system administrators. It is commonly available on Linux and macOS.
Basic dig Command
dig example.com
The output includes a Header, Question, Answer, Authority, and Additional section, along with query time, DNS server used, and response size.
Requesting a Specific Record Type
dig example.com A
dig example.com AAAA
dig example.com MX
dig example.com TXT
dig example.com NS
dig example.com SOA
dig example.com CAA
Displaying a Short Answer
dig example.com A +short
Querying a Specific Resolver
dig @8.8.8.8 example.com A
dig @1.1.1.1 example.com A
dig @9.9.9.9 example.com A
Querying an Authoritative Nameserver
First find the NS records, then query one directly:
dig example.com NS +short
dig @ns1.example.net example.com A
If the authoritative server returns the new record while public resolvers return an old record, the difference is caused by DNS caching.
Tracing the DNS Resolution Path
dig example.com +trace
The trace begins with root servers and follows the delegation path through the TLD servers to the authoritative nameservers. This is especially useful for diagnosing broken nameserver delegation, missing glue records, and incorrect registrar settings.
Reverse DNS Lookup with dig
dig -x 192.0.2.10
Checking DNSSEC Information
dig example.com A +dnssec
How to Use the host Command
The host command provides a simpler interface than dig and is commonly available on Linux and macOS.
host example.com
host -t MX example.com
host -t TXT example.com
host -t NS example.com
host example.com 8.8.8.8
host 192.0.2.10
The host command is useful when you want a fast, readable result without the more detailed output generated by dig.
How to Use Resolve-DnsName in Windows PowerShell
Modern Windows systems include Resolve-DnsName, which often provides more structured information than nslookup.
Resolve-DnsName example.com
Resolve-DnsName example.com -Type A
Resolve-DnsName example.com -Type MX
Resolve-DnsName example.com -Type TXT
Resolve-DnsName example.com -Type NS
Resolve-DnsName example.com -Server 8.8.8.8
Resolve-DnsName is particularly useful for Windows automation because results are returned as structured PowerShell objects rather than plain text.
Online DNS Lookup vs Command Line
| Feature | Online DNS Lookup Tool | Command-Line Lookup |
|---|---|---|
| Ease of use | Very easy | Requires command knowledge |
| Installation | Not required | Tool must be available |
| Mobile compatibility | Excellent | Limited |
| Query specific resolver | Sometimes available | Usually available |
| Query authoritative server | Limited in some tools | Fully supported |
| DNS trace | Rare | Available with dig +trace |
| Automation and scripting | Not practical | Highly suitable |
| Remote perspective | Yes | Uses user’s network by default |
| Best for | Quick checks and beginners | Advanced diagnostics |
Use an online tool for quick DNS checks, mobile use, or when you need an external perspective. Use command-line tools when troubleshooting complex DNS problems, comparing resolvers, querying authoritative servers, tracing delegation, or automating lookups. In professional troubleshooting, both methods are often used together.
How to Check DNS Propagation
After a DNS record is changed, recursive resolvers continue caching the old answer until its TTL expires. This explains why two users can temporarily receive different DNS answers after a change.
To investigate a recent DNS change, query the authoritative nameserver directly, then compare several public resolvers:
dig @ns1.example.net example.com A
dig @8.8.8.8 example.com A
dig @1.1.1.1 example.com A
dig @9.9.9.9 example.com A
You can also use nslookup.net/tools/dns-propagation-checker to check DNS propagation across multiple global locations simultaneously from a browser.
If authoritative servers return different answers from one another, the issue is not simply caching — the DNS provider may have inconsistent zones or an incomplete update.
How to Troubleshoot Common DNS Lookup Problems
NXDOMAIN means the queried domain does not exist according to the answering DNS system. Check the domain spelling, nameservers, registration status, and authoritative DNS zone.
Timeout may indicate the DNS server is unreachable, UDP or TCP port 53 is blocked, or the authoritative server is offline. Try another resolver to isolate the issue.
Different servers return different answers may be caused by cached records, GeoDNS returning location-based responses, CDN dynamic DNS, load balancing, or inconsistent authoritative zones. Query the authoritative nameservers directly before deciding which answer is correct.
Updated record still shows old value. First confirm the authoritative server shows the new value, then wait for cached TTLs to expire. You can clear your local DNS cache, although this does not affect internet provider or public DNS resolver caches.
Clear DNS cache on Windows:
ipconfig /flushdns
Clear DNS cache on macOS:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Clear DNS cache on Linux (systemd-resolved):
sudo resolvectl flush-caches
How to Read TTL Values
TTL (Time to Live) tells recursive resolvers how long a DNS response may be cached. A TTL of 3600 means the record may be cached for 3,600 seconds — one hour. Lower TTL values allow faster changes but increase DNS query volume. Before a major migration, administrators often lower TTL values in advance so the change propagates quickly.
Frequently Asked Questions
What is the easiest way to do a DNS lookup?
The easiest method is to use an online DNS lookup tool such as nslookup.net/tools/dns-record-lookup. Enter the domain, select the DNS record type, and review the results. No command-line knowledge or software installation is required.
What command is used for a DNS lookup?
Common DNS lookup commands include nslookup example.com, dig example.com, and host example.com. Windows PowerShell users can run Resolve-DnsName example.com.
Is nslookup the same as a DNS lookup?
nslookup is a command-line utility used to perform DNS lookups. A DNS lookup is the general process, while nslookup is one of several tools that can perform it.
Is dig better than nslookup?
dig generally provides more detailed output and more advanced diagnostic options. It is often preferred by system administrators. However, nslookup is easier for basic checks and is available by default on Windows.
How do I check all DNS records for a domain?
There is no single DNS query guaranteed to return every record in a zone. Instead, query the relevant record types individually using dig example.com A, dig example.com MX, dig example.com TXT, dig example.com NS, and so on. Alternatively, use nslookup.net/tools/dns-record-lookup and select “Any” to see all major record types in one query.
How do I check DNS from a specific server?
With nslookup: nslookup example.com 8.8.8.8. With dig: dig @8.8.8.8 example.com. With PowerShell: Resolve-DnsName example.com -Server 8.8.8.8.
How do I perform a reverse DNS lookup?
With nslookup: nslookup 192.0.2.10. With dig: dig -x 192.0.2.10. With host: host 192.0.2.10. You can also use the free online tool at nslookup.net/tools/reverse-dns-lookup.
Why does an online DNS lookup show a different result from my computer?
The online tool and your computer may use different recursive resolvers. One resolver may have cached an older record, or the domain may use location-based DNS routing. Query the authoritative nameserver and compare several public resolvers to investigate the difference.
Can a DNS lookup show who owns a domain?
A DNS lookup shows technical DNS records, not necessarily domain ownership information. Domain registration information is generally checked through an RDAP or WHOIS lookup.
Conclusion
A DNS lookup provides essential information about how a domain, website, email system, or internet service is configured. For quick checks, an online DNS lookup tool is usually the most convenient option. For advanced troubleshooting, command-line tools provide more flexibility — nslookup is widely available and easy to use, while dig offers detailed responses, authoritative server queries, DNS tracing, and resolver comparison.
The most reliable troubleshooting approach is often to combine both methods: start with nslookup.net’s free online DNS lookup to see what an external resolver returns, then use command-line queries to compare public resolvers, inspect authoritative nameservers, and examine TTL values.