How to Check MX Records in CMD and Terminal: A Complete 2026 Guide

Quick Summary: To check MX records via CMD (Windows), use the command nslookup -type=mx domain.com. For Terminal (Mac/Linux), use dig domain.com MX. These commands query DNS servers directly to identify the mail servers responsible for receiving email on behalf of a specific domain.
Why Do You Need to Check MX Records?
Mail Exchanger (MX) records are the traffic controllers of the email world. They specify which mail servers are authorized to accept email for a domain, prioritized by a preference value. If these records are misconfigured, emails will bounce, or worse, disappear into the digital void.
Expert Perspective: In 2026, with the widespread adoption of strict DMARC and SPF policies, verifying your MX records is the first step in diagnosing delivery failures. According to recent industry telemetry, over 30% of mail delivery issues stem from TTL (Time to Live) lag during DNS migrations.
Checking MX records locally via command-line tools provides a "clean" look at what the public internet sees, bypassing browser caches that might display outdated information. This is an essential skill for check MX records workflows and broader DNS lookup commands strategies.
How Do I Check MX Records Using Windows Command Prompt?
The nslookup (Name Server Lookup) utility is the standard tool for Windows environments. It allows you to query Domain Name System (DNS) infrastructure to obtain mapping or any specific DNS record.
Step-by-Step nslookup Guide
- Press Win + R, type
cmd, and hit Enter. - Type
nslookupand press Enter to enter the interactive mode. - Set the query type to MX by typing
set type=mx. - Enter the domain name (e.g.,
google.com).
Pro Tip: You can run this in a single line for speed: nslookup -q=mx google.com. If you suspect your local ISP's DNS is cached, point the query to Google's Public DNS by adding 8.8.8.8 at the end: nslookup -q=mx google.com 8.8.8.8.
How to Use the 'dig' Command in Terminal?
For macOS and Linux users, dig (Domain Information Groper) is the preferred tool. It is more flexible and provides more detailed output than nslookup, making it a favorite for network engineers and system administrators.
The Anatomy of a Dig Command
To check MX records, simply open your Terminal and execute:
dig example.com MX
The "ANSWER SECTION" in the output will show the preference (priority) and the mail server's hostname. Lower numbers in the preference column indicate higher priority.
Insider Observation: When we test DNS propagation at scale, we find that dig +short example.com MX is the most efficient way to get a clean list of servers without the verbose header metadata, perfect for automation scripts.
Why Is My MX Record Not Showing Up?
If your query returns no results or an error like NXDOMAIN, several factors could be at play. Understanding the hierarchy of DNS is vital here.
- Propagation Delay: Changes to DNS records can take up to 48 hours to propagate globally, though in 2026, most records update within 1-2 hours.
- TTL (Time to Live): A high TTL value means servers will hold onto the old record longer before asking the authoritative nameserver for an update.
- Authoritative Nameservers: Ensure you are querying the correct nameservers. Sometimes a domain is registered with one provider but the DNS is managed by another (like Cloudflare or Route 53).
Deep-Technical Q&A for Professionals
What happens if two MX records have the same priority?
If two records share the same priority value, mail servers will perform "load sharing" by picking one at random or using a round-robin approach. This is often used for high-availability setups across multiple data centers.
Can an MX record point to an IP address directly?
No. According to RFC 2181, an MX record must point to a Domain Name (an A or AAAA record), not an IP address. Pointing an MX record directly to an IP is a common configuration error that causes delivery failures on many modern MTAs (Mail Transfer Agents).
How do I check MX records for a sub-domain?
The process is identical: use nslookup -q=mx mail.example.com. However, remember that if no MX record exists for a sub-domain, some mail servers will attempt to deliver to the A record of that sub-domain as a fallback (per RFC 5321).
What is a "Null MX" record?
A Null MX record (specified as MX 0 .) is used to explicitly state that a domain does not accept email. This is a security best practice for "no-reply" or purely web-based domains to prevent spamming and reduce server load.
How does the 'any' query differ from 'mx'?
Using dig example.com ANY attempts to pull all known records. However, due to DNS amplification attack mitigations, many modern nameservers (like Cloudflare) have deprecated the ANY query or return limited results. Querying for 'MX' specifically is always more reliable.
Why does nslookup show 'Non-authoritative answer'?
This means the information was retrieved from a cached source (like your ISP or a local resolver) rather than the official nameserver where the domain is hosted. It is usually accurate but might be slightly outdated if changes were made recently.
Can MX records lead to email loops?
Yes, if Domain A's MX record points to a server on Domain B, and Domain B points back to Domain A without proper local delivery configuration, a loop occurs. Checking your records via Terminal helps visualize the path and identify these circular references.
Does IPv6 affect MX records?
The MX record itself remains the same (pointing to a hostname). However, that hostname must have an AAAA record for mail to be delivered via IPv6. Use dig hostname AAAA to verify if your mail server is IPv6-ready.
For further reading on DNS standards, visit the ICANN official site, the IETF RFC Database, or Google Admin Toolbox.

Ramal Jayaratne
Lead Developer & System ArchitectLead Developer at ToolCheckers, specializing in Python, Django, and System Architecture. With over a decade of experience, Ramal is dedicated to building transparent, high-performance developer tools.