How to Use the dig Command
dig is a command that sends DNS queries and shows the results. Here are the basics and the forms you will use most.
Use dig in your browserFree, no sign-up
Basic forms
dig example.com # A record dig example.com MX # specify the type dig example.com TXT +short # show only the value dig @8.8.8.8 example.com # specify the DNS server to ask dig -x 8.8.8.8 # reverse lookup (PTR) dig example.com NS +trace # follow the chain from the root
How to read the output
The answer appears in the ANSWER SECTION. From left to right it shows the name, TTL, IN, type and value. A status: of NOERROR means success, NXDOMAIN means the name does not exist, and SERVFAIL means the server failed. If flags contains aa, the answer came from the authoritative DNS server.
Main options
+short: Shows only the value. Handy for scripts.@server: Specifies the server to ask. Use it to query an authoritative DNS server directly.+trace: Follows the chain from the root down. Use it to find which part of the setup is the cause.+dnssec: Also retrieves DNSSEC information.
What about Windows?
Windows doesn’t come with dig. The built-in nslookup is a close substitute (nslookup -type=MX example.com). If you use WSL, you can use dig too. If installing it is a hassle, looking things up in your browser with Web dig is an easy alternative.
How it maps to Web dig
- Specifying the type → choose the “Record types”
@server→ “DNS servers to ask” (you can pick several)+short→ “Values only”+dnssec→ “Include DNSSEC data”-x→ just enter an IP address to get a reverse lookup
For the kinds of records, see the list of DNS record types.
FAQ
Which operating systems have dig?
It comes built in on Mac and Linux. Windows doesn’t include it, so use nslookup or WSL.
What is the difference between dig and nslookup?
Both look up DNS, but dig gives more detailed output and has more options.
More guides
- How to Check MX Records
- How to Check DNS Propagation
- How to Look Up an SPF Record
- How to Do a Whois Lookup
- How to Do a Reverse Lookup (PTR)
- DNS Record Types Explained
Last updated: 2026-10-21