Founder price · 100 spots leftReserve

[ Guide ]

MX records explained: what they are and how to set them

What an MX record is, how priority and TTL work, how to check yours with dig or nslookup, and the mistakes that make mail bounce or go missing.

· 6 min read

[ In short ]

  • An MX record tells other mail servers which host receives email for your domain.
  • Each MX has a priority number: senders try the lowest first, and pick at random between equal numbers.
  • An MX must point to a host name with an A or AAAA record, never to an IP address or a CNAME.
  • To change email providers, replace the old MX records instead of adding new ones next to them, and check with dig MX example.com.

01What is an MX record?

An MX (mail exchanger) record is a DNS record that names the server that accepts email for a domain. When someone writes to ana@example.com, their mail server looks up the MX records of example.com and delivers the message to the host listed there. Without one, mail to your domain has nowhere reliable to go.

MX records
example.com.  3600  IN  MX  10 mx1.provider.example.
example.com.  3600  IN  MX  20 mx2.provider.example.

Each line has the name the record belongs to (example.com.), a TTL in seconds (3600), the class and type (IN MX), a preference number (10) and the host that receives mail (mx1.provider.example.). The trailing dot means the name is complete; dashboards usually add it for you.

MX records only control incoming mail. Sending is a separate matter, handled by SPF, DKIM and DMARC. You can receive at one provider and send from another, as long as each is set up correctly.

02How MX priority works

The number in front of the host is its preference, often called priority. Lower means preferred. A sending server sorts the records, tries the lowest number first and moves to the next only if the first does not answer. Records with the same number share the load: RFC 5321 §5.1 tells senders to pick among them at random.

RecordsWhat senders do
10 mx1 · 20 mx2Always mx1; mx2 only when mx1 is down. A primary and a backup.
10 mx1 · 10 mx2Half to each, roughly. Load spread across two hosts.
1 smtp.google.comA single record: the provider handles redundancy behind one name.

The numbers themselves mean nothing; only their order does. 10 and 20 behave exactly like 1 and 2. Use the values your provider gives you so their support can read your setup.

Every MX record must belong to the same provider. A backup MX at another company accepts mail your main provider never sees.

03How to add or change MX records

  1. Open the DNS settings where your domain’s nameservers point (your registrar, Cloudflare, or your web host).
  2. Delete the MX records of your old provider. Leaving them at a higher number still sends some mail there when the new host is slow to answer.
  3. Add the new records: type MX, host @ (the domain itself), the priority, and the mail server host name your provider gives you.
  4. Keep the TTL low (300 seconds) during the change and raise it to 3,600 or more once mail flows.
  5. Send a test from an outside account (a personal Gmail, for example) and confirm it arrives at the new host.
  • MXMX (primary)Required

    Tells other servers where to deliver mail for your domain. The lowest number is tried first. RFC 5321 §5.1

    Host
    example.com.
    Value
    10 mx1.provider.example.
  • MXMX (backup)Required

    A second host at a higher number, used when the first does not answer. Both must belong to the same provider. RFC 5321 §5.1

    Host
    example.com.
    Value
    20 mx2.provider.example.
  • TXTSPFRequired

    Lists the servers allowed to send with your domain as the envelope sender. Exactly one per domain, at most 10 DNS lookups. RFC 7208

    Host
    example.com.
    Value
    v=spf1 include:spf.provider.example ~all
  • CNAMEDKIMRequired

    Points to the public key that verifies the signature on your outgoing mail. A CNAME lets the provider rotate keys without you touching DNS. RFC 6376

    Host
    s1._domainkey.example.com.
    Value
    s1.dkim.provider.example.
  • TXTDMARCRequired

    Says what receivers should do when SPF and DKIM do not line up with your From address, and where to send daily reports. RFC 9989

    Host
    _dmarc.example.com.
    Value
    v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
  • TXTMTA-STSOptional

    Announces a policy that makes senders use verified TLS when they deliver to you. Change the id whenever the policy file changes. RFC 8461

    Host
    _mta-sts.example.com.
    Value
    v=STSv1; id=20261005T000000
  • CNAMEMTA-STS policy hostOptional

    Serves the policy file at https://mta-sts.example.com/.well-known/mta-sts.txt, which needs a valid certificate for that name. RFC 8461 §3.3

    Host
    mta-sts.example.com.
    Value
    mta-sts.provider.example.
  • TXTTLS-RPTOptional

    Asks senders for daily reports of TLS failures when delivering to you. Pairs with MTA-STS. RFC 8460

    Host
    _smtp._tls.example.com.
    Value
    v=TLSRPTv1; rua=mailto:tls-reports@example.com
  • CNAMEAutoconfigOptional

    Lets Thunderbird and other clients fill in the server settings when someone adds the account. Mozilla autoconfig

    Host
    autoconfig.example.com.
    Value
    autoconfig.provider.example.
  • CNAMEAutodiscoverOptional

    The same for Outlook. Without it, people type the server names by hand. Microsoft Autodiscover

    Host
    autodiscover.example.com.
    Value
    autodiscover.provider.example.
  • SRVIMAP serviceOptional

    Tells mail apps which host and port to use to read mail over TLS. RFC 6186

    Host
    _imaps._tcp.example.com.
    Value
    0 1 993 imap.provider.example.
  • SRVSubmission serviceOptional

    Tells mail apps where to send mail from, over implicit TLS on port 465. RFC 8314

    Host
    _submissions._tcp.example.com.
    Value
    0 1 465 smtp.provider.example.
Where the MX records sit among the other records a business email domain needs.

Moving a whole team between providers needs more than the MX switch: mail has to be copied and the change timed so nothing lands in the old mailbox unseen. The full sequence is in how to migrate from Google Workspace, and it works the same for any provider.

04How to check your MX records

From a terminal on macOS or Linux:

dig
dig MX example.com +short
# 10 mx1.provider.example.
# 20 mx2.provider.example.

On Windows:

nslookup
nslookup -type=MX example.com

To skip caches and see what your DNS host actually publishes, ask its nameserver directly: find it with dig NS example.com +short, then run dig MX example.com @ns1.your-dns-host.example. If the authoritative answer is right but a public resolver still shows the old records, you are waiting for the old TTL to run out.

05TTL and propagation: how long changes take

The TTL is how many seconds resolvers may keep a record in their cache. When you change an MX record, resolvers that cached the old one keep using it until their copy expires. So the time a change takes is set by the TTL the old record had, not the new one.

  • Before a planned switch, lower the TTL to 300 seconds at least one full old TTL ahead (a day ahead covers most cases).
  • During the switch, changes reach most senders within five minutes.
  • After, raise the TTL back to an hour or more. Some senders keep a stale route for longer, so keep the old mailboxes open for a few days.

“Propagation” is the name people give to this cache expiry. Nothing is pushed around the internet; each resolver simply asks again when its copy is old.

06Common MX mistakes

MistakeWhat happensFix
MX points to a CNAMEForbidden by RFC 2181 §10.3; some senders refuse to deliverPoint MX at the host name that has the A/AAAA record
MX value is an IP addressInvalid; senders treat it as a host name and failUse a host name
Old and new MX side by sideMail splits between two providers, silentlyDelete the old records during the switch
MX on the wrong hostTyping example.com in a field that appends the domain creates example.com.example.com@ or leave the host empty, as the dashboard expects
No MX at allSenders fall back to the domain’s A record, usually a web serverAdd MX, or a null MX

Null MX: saying “this domain takes no mail”

Domains that should never receive email, such as a marketing domain or a parked name, can publish a null MX (RFC 7505). Senders then fail fast instead of trying the web server. Pair it with v=spf1 -all and a DMARC p=reject so nobody can send as that domain either.

A domain that sends and receives no mail
parked.example.   3600  IN  MX   0 .
parked.example.   3600  IN  TXT  "v=spf1 -all"
_dmarc.parked.example.  3600  IN  TXT  "v=DMARC1; p=reject"

07MX records for subdomains

Each name has its own MX records. Mail to team@support.example.com looks up the MX of support.example.com, not of example.com. That lets you receive replies to a newsletter or a help desk at another service without touching your main mail.

With Skein, the MX records point at its EU mail servers and are among the records it writes for you on supported DNS providers. To see what else a domain needs, read SPF, DKIM and DMARC explained.

Questions

What does the number in an MX record mean?
It is the preference. Senders try the lowest number first and use higher numbers only when the lower ones do not answer. Records with the same number share the mail at random.
Can I have MX records for two email providers?
Not for the same domain. Senders would deliver to whichever answers, so mail would split between providers with no warning. Use one provider per domain, or a subdomain for the second one.
How long does an MX record change take?
Up to the TTL the old record had, because resolvers keep it cached until then. Lower the TTL to 300 seconds a day before the change and most senders follow within minutes.
Can an MX record point to an IP address?
No. An MX record holds a host name, and that name must have an A or AAAA record with the address. It must not be a CNAME either.
What happens if a domain has no MX record?
Senders fall back to the domain’s own A or AAAA record (RFC 5321 §5.1), which is usually a web server that does not accept mail. If a domain should receive nothing, publish a null MX instead.

See Skein follow up for you

Business email on your own domain with an agent that follows up on every conversation. Hosted in the EU. Try the demo with sample mail, nothing to install.

[ Sources ]

  1. 01RFC 5321: SMTP, §5.1 Locating the target host
  2. 02RFC 2181: Clarifications to the DNS specification (§10.3)
  3. 03RFC 7505: A “Null MX” no service resource record
  4. 04RFC 1035: Domain names, implementation and specification
  5. 05Google Workspace: set up MX records

Facts about other products were checked on 5 Oct 2026; prices and plans change.

[ Read next ]