What is an MX record?
Reviewed by Prabath Thalangama · Last updated
An MX (mail exchanger) record tells other mail servers which hosts accept email for a domain and in what order to try them. Each record has a preference number and a host name; lower numbers are tried first. This lookup lists a domain's MX records and the IP addresses each mail host resolves to.
When someone sends mail to [email protected], their server looks up the MX records for example.com, connects to the most preferred host, and falls back to the next one if it is unreachable. Hosts with the same preference share the load.
Use this lookup to confirm a move to Google Workspace or Microsoft 365 has taken effect, to spot records left over from an old provider, or to start troubleshooting bounced mail.
How do I look up a domain's MX records?
- Enter the domain part of the email address, for example example.com.
- Check that every mail host belongs to your current provider and has the preference you expect.
- Confirm each host resolves to an IP address. A host with no address cannot receive mail.
How to read the results
- Preference
- The priority of the host. Lower is tried first; the absolute values do not matter, only their order.
- Mail host
- The server that accepts mail. It must be a host name with its own A or AAAA record.
- Resolved IPs
- The addresses that host name points to, so you can see which network actually receives your mail.
Common MX record mistakes
MX points to an IP address or a CNAME
The MX target must be a host name with an A or AAAA record. An IP address is invalid syntax, and RFC 2181 forbids pointing MX at an alias (CNAME); some senders will refuse to deliver.
Records from an old provider are still there
After migrating, delete the old provider's MX records. Senders that pick an old host will deliver mail to a mailbox you no longer read, or bounce it.
No MX record
Without MX records senders fall back to the domain's A record, which is rarely a mail server. A domain that should never receive mail can say so with a null MX record (RFC 7505).
Examples and command-line equivalents
Google Workspace
Google's current setup uses a single MX host; older setups list five aspmx hosts, which still work.
example.com. MX 1 smtp.google.com.Microsoft 365
Copy the exact host from the Microsoft 365 admin center; it is based on your domain name.
example.com. MX 0 example-com.mail.protection.outlook.com.Null MX: this domain accepts no mail
example.com. MX 0 .Look up MX records from the command line
dig +short MX example.com
nslookup -type=MX example.com
# Ask a specific resolver
dig +short MX example.com @1.1.1.1Frequently asked questions
What MX priority should I use?
Any numbers work; only the order matters. Give your primary host the lowest number. Use equal numbers to spread mail across several hosts, and a higher number for a backup host.
How long do MX changes take?
Sending servers pick up the new records once the old records' TTL expires, often within an hour. Mail sent during the switch may still go to the old provider, so keep the old mailboxes for a day or two.
Do I need a backup MX?
Usually not. Sending servers queue and retry for days if your mail server is down. A badly configured backup MX is a common source of spam, because it may accept mail without your main server's filtering.
Further reading
- SPF, DKIM, and DMARC End to End
- Postfix as a Null Client: Send-Only Mail Done Right
- DNS Resolution, Step by Step
- RFC 5321 §5: Address resolution and mail handling
- RFC 7505: A "Null MX" no service resource record
- Run a full Super Scan to check DNS, email, website and TLS for a domain at once.