How to Look Up MX Records With nslookup, dig and PowerShell

The Fastest Way

If you just need the answer, enter the domain in our DNS Record Lookup and choose MX. The commands below are useful when you want to test from your own network or query a specific DNS server.

nslookup (Windows, macOS, Linux)

nslookup -type=mx example.com

To ask a specific resolver, add it at the end. This is useful to compare your local resolver with a public one:

nslookup -type=mx example.com 8.8.8.8

Typical output lists each mail server with its preference value:

example.com  MX preference = 10, mail exchanger = mx1.example.net
example.com  MX preference = 20, mail exchanger = mx2.example.net

dig (macOS, Linux)

dig example.com MX +short

+short prints only the answer, for example 10 mx1.example.net.. Without it, dig also shows the TTL, which tells you how long resolvers will cache the records. To query a domain’s own authoritative server directly, use dig @ns1.example.net example.com MX.

PowerShell (Windows)

Resolve-DnsName example.com -Type MX

Add -Server 1.1.1.1 to choose the resolver.

How to Read the Results

Preference (Priority)

The number before each mail server is its preference. Lower numbers are tried first. Servers with higher numbers are backups, used when the preferred server cannot be reached. Servers with the same number share the load.

Hostnames, Not IP Addresses

An MX record must point to a hostname that has an A or AAAA record. Pointing MX to an IP address or to a CNAME is a configuration error that some senders will not accept.

No MX Record

If a domain has no MX record, many sending servers fall back to the domain’s A record and try to deliver mail there. A domain that should never receive mail can publish a null MX — a single record with preference 0 and the host . — to say so explicitly.

Common Problems Found With an MX Lookup

  • Old provider still listed after a migration, so some mail goes to the old mailbox.
  • Typos in the hostname, often a missing trailing part of the domain added automatically by the DNS panel (for example mx.example.net.example.com).
  • Different answers from different resolvers after a recent change — see How to check DNS propagation.

Next Steps

Link to or cite this page

Found this useful? You are welcome to link to it from your website, documentation, course material or forum answers.

HTML link <a href="https://ipdnshub.com/resources/how-to-look-up-mx-records-with-nslookup-and-dig">How to Look Up MX Records With nslookup, dig and PowerShell – IP DNS Hub</a>
Citation "How to Look Up MX Records With nslookup, dig and PowerShell." IP DNS Hub. https://ipdnshub.com/resources/how-to-look-up-mx-records-with-nslookup-and-dig