MX record — mail exchanger
An MX record tells other mail servers where to deliver mail for your domain. Each record carries a preference number and a hostname, and the sending server tries the lowest preference first — lower means more preferred, which is the opposite of what the word “priority” suggests to most people and the reason backup mail servers are so often configured backwards.
Equal preference values mean load sharing between those hosts; different values mean fallback. A backup MX at a higher number is a much less useful idea than it used to be, because spammers deliberately target secondary servers expecting weaker filtering — most modern setups publish several equal-preference hosts belonging to the same provider instead.
Two rules that break real deployments. The MX target must be a hostname with an address record, never a CNAME and never an IP address — RFC 2181 is explicit, and some receiving servers refuse mail outright when it is wrong. And a domain that sends mail but should never receive it publishes a null MX (RFC 7505): preference 0 with a single dot as the target, which tells senders to reject immediately rather than queue for days.
What a MX record looks like
Type 15 · Mail exchanger (priority target). Zone-file form below — owner name, TTL, then the record and its RDATA.
| Name | TTL | Record | What it means |
|---|---|---|---|
| example.com. | 3600 | MX 10 mail1.example.com. | Preferred: the lowest preference number is tried first. |
| example.com. | 3600 | MX 20 mail2.example.com. | Fallback, used only when the preference-10 host is unreachable. |
| example.com. | 3600 | MX 10 alt1.example.com. | Equal preference to mail1 — the two share the load rather than one backing up the other. |
| noreply.example.com. | 3600 | MX 0 . | A null MX (RFC 7505): this domain accepts no mail, so senders fail fast instead of queueing. |
The mistakes that break production
Pointing the MX at a CNAME or an IP address
Both are invalid. The MX target must be a hostname that resolves via A/AAAA records directly. Some receiving servers tolerate a CNAME and some reject the delivery, which produces the worst symptom in mail: it works from most senders and silently fails from a few.
Getting the preference direction backwards
Lower is more preferred. Setting the main server to 20 and a barely-monitored backup to 10 sends all mail to the backup, where the filtering is usually weaker and the mailbox is not watched. Check the numbers, not the order the control panel displays them in.
Query a MX record now
The box below is seeded with example.com. Choose MX as the type and press Look up — the query goes from your browser straight to Cloudflare or Google over DNS-over-HTTPS, with no server of ours in the path.
DNS is the internet's address book: it turns a name like example.com into the addresses and service endpoints machines actually connect to. Every record has a type (what kind of fact it states) and a TTL (how long resolvers may cache it).
Record types
| Type | What it stores |
|---|---|
| A | IPv4 address |
| AAAA | IPv6 address |
| CNAME | Canonical name (alias) |
| MX | Mail exchanger (priority target) |
| TXT | Text — SPF, verifications, DKIM, arbitrary data |
| NS | Authoritative nameservers |
| SOA | Start of authority (serial, refresh, retry, expire, minimum) |
| SRV | Service locator (priority weight port target) |
| CAA | Which CAs may issue certificates |
| PTR | Reverse DNS (IP → name) |
| DNSKEY | DNSSEC public key |
| DS | Delegation signer (DNSSEC chain of trust) |
| HTTPS | HTTPS service binding (ALPN, ECH, hints) |
| SVCB | General service binding |
| TLSA | DANE — pin certificates in DNS |
| NAPTR | Name authority pointer (SIP/ENUM) |
TTL & “propagation”
DNS changes don't “push” anywhere — resolvers simply keep the old answer until its TTL runs out, then fetch the new one. So a change “propagates” in at most the old record's TTL. Planning a change? Lower the TTL (e.g. to 300s) a day in advance, make the change, then raise it back. The compare card above shows whether major public caches have picked your change up yet.
FAQ
What does the number in an MX record mean?
It is a preference: the sending server tries the lowest value first and moves up only if that host is unreachable. Equal values share the load between those hosts.
Can an MX record point to a CNAME?
No. RFC 2181 requires the target to be a hostname with address records. A CNAME target is a configuration error that some senders tolerate and others reject.
What is a null MX?
MX 0 with a target of "." — a declaration that the domain accepts no mail at all. Senders reject immediately rather than retrying for days, which is the correct setup for a send-only or parked domain.