Published

Linux

Check DNS Records in 10 Seconds: dig and nslookup

Many website and email problems start with DNS. These commands show the A, MX and TXT records for any domain, straight from the source, on Mac, Linux and Windows.

1. Website address (A record)

Shows the IP address the domain points to. Use AAAA for IPv6.

dig +short example.com A

2. Mail servers (MX record)

Shows which servers receive email for the domain, with their priority.

dig +short example.com MX

3. TXT records (SPF and verification)

Shows TXT records, including SPF (v=spf1 …) and site verification codes.

dig +short example.com TXT

4. Ask a specific DNS server, or use Windows

Query a public resolver to see what the rest of the internet sees. On Windows, nslookup does the same job.

dig @1.1.1.1 example.com
nslookup -type=mx example.com
nslookup -type=txt example.com

Free tool: DNS lookup

Prefer a browser? The free DNS lookup on our security tools page shows A, MX, TXT and more for any domain. No signup. Open the free DNS lookup

FAQ

I changed a DNS record. Why do I still see the old one?

Resolvers cache records for the record's TTL. Query the domain's own name server (dig @ns1.yourdns.com example.com) to see the new value, and wait for the TTL to expire elsewhere.

dig is not installed on my Linux server. How do I get it?

Install the DNS utilities package: sudo apt install dnsutils on Debian and Ubuntu, sudo dnf install bind-utils on RHEL, Alma and Rocky.