What is an MX record? A plain explanation with examples
An MX record is the line in your domain’s DNS that says where email for that domain should be delivered. Get it wrong and mail does not bounce right away: it waits, retries, and then disappears days later.
MX records in one paragraph
MX stands for mail exchanger. Each MX record has two parts: a priority number and the hostname of a mail server. When someone sends mail to you@example.com, their server asks DNS for the MX records of example.com, picks the one with the lowest number, looks up that hostname’s IP address and delivers the message there.
A real MX record example
Here is a small but complete mail setup for a domain that runs its own server:
example.com. 3600 MX 10 mail.example.com. example.com. 3600 MX 20 backup.example.net. mail.example.com. 3600 A 203.0.113.10 mail.example.com. 3600 AAAA 2001:db8::10 example.com. 3600 TXT "v=spf1 mx ~all"
Reading it left to right: the domain, the TTL in seconds, the record type, the priority, and the target hostname. The trailing dot means "this is a full name", and most DNS panels add it for you.
For a hosted provider the MX record is usually a single line. Google Workspace uses 1 smtp.google.com., and Microsoft 365 uses a host under mail.protection.outlook.com. Our guides for Google Workspace and Microsoft 365 list the exact records.
How sending servers use MX records
- The sender’s server looks up the MX records for the domain after the @.
- It sorts them by priority, lowest number first. See how MX priority works.
- It resolves the chosen hostname to an IPv4 (A) or IPv6 (AAAA) address.
- It opens an SMTP connection on port 25, usually upgrades to TLS with STARTTLS, and hands over the message.
- If that server does not answer, it tries the next MX. If none answer, it queues the message and retries for several days.
If a domain has no MX record at all, senders fall back to the domain’s own A record. That fallback is why a parked domain with a web server can still receive spam attempts on port 25.
The target must be a hostname with an A record
This is the rule people break most often. An MX record points to a name, not a number, and that name must resolve with its own A or AAAA record.
| MX target | Works? | Why |
|---|---|---|
10 mail.example.com. with an A record | Yes | The correct setup. |
10 203.0.113.10 | No | An IP is not a valid MX target. Senders look it up as a hostname and fail. |
10 mail.example.com. that is a CNAME | Unreliable | RFC 2181 forbids MX targets that are aliases. Some servers follow it, some refuse. |
10 mail.example.com. with no A record | No | The name does not resolve, so there is nowhere to connect. |
Null MX: saying "this domain takes no mail"
Domains that never receive email, such as a parked domain or a site that only sends notifications from a subdomain, should publish a null MX as defined in RFC 7505:
example.org. 3600 MX 0 . example.org. 3600 TXT "v=spf1 -all" _dmarc.example.org. 3600 TXT "v=DMARC1; p=reject"
The single dot means "no mail server". Senders bounce at once instead of retrying for days, and with the SPF and DMARC lines nobody can send mail as that domain either. A null MX must be the only MX record for the domain.
Forwarding-only MX records
Many registrars offer free email forwarding. They do it by setting your MX records to their own forwarding servers, for example 10 mx1.forwarding.example-registrar.com.. Mail arrives there and is passed on to your Gmail or iCloud address.
That is fine for receiving. Two things to know: forwarded mail often fails SPF at the final inbox, and you cannot send replies through the forwarder. If you reply from Gmail as contact@yourdomain, the message is not covered by your domain’s SPF or DKIM unless you set up proper sending.
Common MX record mistakes
- Leftover records from an old host. After a move, the old MX stays with a lower number and keeps getting mail you never see.
- An IP address in the MX field. Use a hostname and add an A record for it.
- MX pointing to a CNAME. Point it at the real hostname instead.
- Hostname in the name field. In most panels the name is
@(the domain itself), notmail. - Missing trailing dot in a zone file.
mail.example.comwithout the dot becomesmail.example.com.example.com. - A backup MX with weaker filtering. Spammers target it on purpose. See MX priority and backup MX.
- No MX on a domain that sends mail. Replies and bounces have nowhere to go, and some receivers score the sender lower.
Check your MX records
Run a single domain through the MX lookup to see its records, priorities and the IP behind each host. To check MX together with SPF, DKIM, DMARC, the STARTTLS certificate and blacklists for up to 25 domains at once, use the free mail health checker.
Questions
What is an MX record in simple terms?
An MX (mail exchanger) record is a DNS entry that tells other mail servers which server accepts email for your domain. Without one, mail to you@yourdomain has nowhere to go.
Can an MX record point to an IP address?
No. An MX record must point to a hostname, and that hostname must have its own A or AAAA record. Many DNS panels accept an IP in the field, but sending servers will treat it as a hostname and delivery fails.
Can an MX record point to a CNAME?
It should not. RFC 2181 says the target of an MX record must not be an alias. Some servers follow the CNAME anyway, others refuse, so point MX at a hostname with an A record.
How many MX records should a domain have?
One is enough if your provider runs a redundant service behind it, as Google Workspace and Microsoft 365 do. Several MX records are fine as long as every one of them points to a server that really accepts and filters your mail.
How long does an MX record change take to work?
It depends on the TTL of the old record. With a TTL of 3600 most senders pick up the change within an hour; some caches keep the old value up to a day. Lower the TTL a day before a planned move.
One Mac inbox for all your domains. MXDeck watches every domain’s MX, SPF, DKIM and DMARC and shows a red dot the day something breaks.
Get early access