On this page
What is an MX record
An MX record (mail exchanger record) is a DNS record that answers one question: which server accepts email for this domain? When someone sends a message to anna@example.com, the sending server does not guess. It asks DNS for the MX records of example.com and delivers to the host listed there.
That is why your website and your email can live in completely different places. The A record points browsers at your web server. The MX record points mail at your email provider. Changing one does not touch the other.
An MX record only covers incoming mail. It says nothing about which servers are allowed to send mail as your domain. That job belongs to SPF, DKIM and DMARC.
What the fields in a record MX entry mean
In a zone file, a single MX entry looks like this:
example.com. 3600 IN MX 10 mail1.example.com.The domain that receives the mail.
Seconds a resolver may cache the answer.
Marks the record as a mail exchanger.
Lower numbers are tried first.
The hostname of the server that accepts the mail.
Most DNS control panels split this into three boxes: host or name (often @ for the root domain), priority and value. The format was defined in RFC 1035 and has not changed since.
How does an MX record route an email
Every message between two mail systems follows the same short sequence. The rules come from RFC 5321, the SMTP standard.
- The sender reads the domain
The sending server takes everything after the @ sign. The part before it is ignored until the message reaches the receiving server.
- It asks DNS for the MX records
The answer is a list of mail hostnames, each with a priority number.
- It sorts the list by priority
The host with the lowest number goes first. Hosts with the same number are tried in random order.
- It resolves the mail host to an IP address
A second lookup fetches the A or AAAA record of the mail host, because an MX record holds a name, never an address.
- It connects on port 25 and hands over the message
If the connection fails, the sender tries the next host in the list. If every host fails, it queues the message and retries later.
No MX record at all? The standard tells the sender to fall back to the domain's own A or AAAA record and try delivering there. It works on paper, but do not rely on it. Publish an explicit MX record.
How MX priority values work
The priority (the standard calls it preference) is a number from 0 to 65535. Lower means more preferred. Only the order matters, not the size of the gap: 10 and 20 behave exactly like 1 and 2. People leave gaps so they can slot a new server in between later.
| Setup | Records | What senders do |
|---|---|---|
| Single server | 10 mail1 | Always deliver to mail1. If it is down, queue and retry. |
| Primary and backup | 10 mail1, 20 mail2 | Deliver to mail1. Use mail2 only when mail1 cannot be reached. |
| Load sharing | 10 mail1, 10 mail2 | Pick between the two at random, so traffic spreads across both. |
| Shared pair plus backup | 10 mail1, 10 mail2, 30 mail3 | Spread across mail1 and mail2. Fall back to mail3 if both fail. |
If your provider gives you several records with specific numbers, copy the numbers exactly. They chose that order for a reason.
Why do domains list more than one MX server
A second MX server exists for one reason: so mail still has somewhere to go when the first one is unreachable. Large email providers hand you several hosts in different data centres for exactly this.
You may need it less than you think. A sending server that cannot reach any MX host does not bounce the message straight away. It queues it and keeps retrying, normally for several days. A short outage on a single mail server usually delays mail instead of losing it.
A backup MX also adds work. It must know which addresses are valid, apply the same spam filtering as the primary and forward everything once the primary returns. A neglected backup is a common way for spam to get in, because spammers deliberately target the higher numbered host. If you cannot maintain it properly, one well run server is the safer choice.
How to check MX records for a domain
You do not need access to the DNS control panel. MX records are public, so any lookup tool can read them for any domain.
Check MX records online with a DNS lookup tool
The quickest way is the Pingie DNS Lookup tool:
- Type the domain into the Domain field, for example example.com. Enter the bare domain, without https or a path.
- Open the Record type dropdown and choose MX (Mail Exchange). The default is A, so this step matters.
- Click Lookup.
Each result shows the mail host with its priority in brackets, and the TTL in seconds underneath. The query runs from an external resolver, not from your own computer, so you see what the outside world sees and not a stale answer from your local cache.
Choosing ANY (All Records) instead returns the A, AAAA, MX, NS, TXT and CNAME records in one result, which is handy when you want the full picture of a domain.
Check MX records from the command line
On Windows and macOS, nslookup is already installed. Many minimal Linux server and container images leave it out, so install the dnsutils package on Debian or Ubuntu, or bind-utils on Fedora, RHEL or CentOS. The same package also provides dig.
nslookup -type=mx example.comOn macOS and Linux, dig gives a shorter answer:
dig example.com MX +shortA domain with a primary and a backup returns something like this, priority first:
10 mail1.example.com.
20 mail2.example.com.In PowerShell the equivalent is:
Resolve-DnsName example.com -Type MXFor more on the first command, including how to ask a specific DNS server, see our guide to the nslookup command.
How to read the MX lookup result
| What you see | What it means | What to do |
|---|---|---|
| One or more hosts with priorities | The domain can receive mail. | Compare each host and number with your email provider's setup page. |
| No MX records found | The domain exists but publishes no MX record. | Add the records your provider lists. |
| Domain does not exist | The name is not registered or is misspelled. | Check the spelling and the registration. |
| Lookup timed out | The domain's nameservers did not answer in time. | Retry, then check the NS records of the domain. |
| A host from a provider you left | An old record was never removed. | Delete it, or mail will keep landing in the old mailbox. |
Common MX records DNS mistakes that break email
Most inbound mail problems come down to a handful of errors in the MX records DNS zone.
- An IP address as the value. An MX record must point to a hostname. Create an A record for the mail host and point the MX at that name.
- A CNAME as the target. The mail host should resolve directly through an A or AAAA record. Pointing an MX at an alias is not allowed by the DNS standards and some senders refuse it.
- Old and new provider mixed together. After a migration, leftover records split your mail between two systems. Keep only the current provider's hosts.
- A missing trailing dot. In some DNS panels a value without a final dot gets your domain appended, so mail1.example.com turns into mail1.example.com.example.com. Check the saved record with a lookup.
- Records on the wrong name. An MX on www does nothing for addresses at the root domain. Subdomains need their own MX records if they receive mail.
- Port 25 closed on the mail host. The record can be perfect while a firewall blocks delivery. Run a port check on the mail host with port 25 to see whether it accepts connections from outside.
MX and SPF are separate. Fixing your MX record makes mail arrive. It does not authorise anyone to send. If messages you send are rejected or land in spam, look at the sending side with the SPF checker.
One special case is intentional: a domain that should never receive mail can publish a null MX, a single record with priority 0 and a lone dot as the host. Defined in RFC 7505, it tells senders to fail immediately instead of retrying for days.
When do MX record changes take effect
A new MX record is live on your authoritative nameservers almost as soon as you save it. What takes time is the cache. Every resolver that already looked up your domain keeps the old answer until its TTL runs out.
With a TTL of 3600, a resolver may hand out the old mail host for up to an hour. With 86400, up to a day. The TTL shown next to each record in a lookup tells you the worst case.
For a planned migration, work in this order:
- A few days ahead, lower the TTL of the existing MX records to a short value such as 300 seconds.
- Wait until the old, longer TTL has fully expired.
- Switch the MX records to the new provider.
- Keep the old mailbox running for a few days to catch mail from slow senders.
- Raise the TTL again once everything is stable.

Not sure where your domain's email is going?
Enter your domain, choose MX as the record type and see every mail host with its priority and TTL, as an external resolver sees them.
Frequently asked questions
Technically yes. When no MX record exists, sending servers fall back to the domain's A or AAAA record and try to deliver there. That only works if a mail server runs on the same address as the website, which is rare. Publish an explicit MX record so delivery never depends on the fallback.
No. The value of an MX record must be a hostname, and that hostname must have its own A or AAAA record. If you only have an IP address, create an A record such as mail.yourdomain.com pointing to it, then use that name as the MX value. Many DNS panels reject an IP outright.
Use the numbers your email provider gives you. If you run your own server and have only one, any number works, and 10 is the common choice. With several servers, give the main one the lowest number and backups higher ones. Equal numbers share the traffic between hosts.
The change is live on your nameservers almost immediately, but resolvers keep the old answer until its TTL expires. With a one hour TTL, expect up to an hour. With a one day TTL, up to a day. Lowering the TTL a few days before a migration shortens the wait.
No. MX records only control where incoming email is delivered. Your website is reached through A, AAAA or CNAME records, which stay untouched. You can move email to a new provider without any change to web hosting, as long as you edit only the MX entries in the DNS zone.