Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Learn

MX record: how email gets routed to your domain

An MX (mail exchanger) record names the mail servers that accept email for a domain, each with a priority number where the lowest value is tried first. Without a valid MX record, senders fall back to the domain address record or fail delivery.

The short answer
  • Each MX has a priority (lower = preferred) and a hostname, never an IP address.
  • The MX target must have its own A or AAAA record and must not be a CNAME.
  • Use a null MX (priority 0, target ".") to declare that a domain accepts no email.
Try the mx lookupFree, live, no signup

What does a real MX record set look like?

nslookup -type=MX gmail.com (output observed 2026-11-21)
gmail.com  MX preference = 5,  mail exchanger = gmail-smtp-in.l.google.com
gmail.com  MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com
gmail.com  MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com
gmail.com  MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com
gmail.com  MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com

How do MX priorities behave?

Delivery order for a sending server
SetupExampleWhat happens
One server10 mail.example.comAll mail goes there; the number only matters with several records
Primary and backup10 mx1 / 20 mx2Mail goes to the priority 10 host and uses 20 only if 10 is unreachable
Equal priorities10 mx1 / 10 mx2Senders spread delivery across both hosts roughly equally
No MX at all(none)Senders may fall back to the domain A/AAAA record, which usually is not a mail server
Null MX0 .Declares the domain accepts no email, so senders fail at once (RFC 7505)

Lower preference values are preferred per RFC 1035, section 3.3.9. Priority is a 16-bit number (0 to 65535).

How do you set up MX records?

  1. 01

    Copy the values from your mail provider

    Google Workspace, Microsoft 365, Fastmail and others publish the exact hostnames and priorities. Never guess them.

  2. 02

    Delete old MX records

    Leftover MX records from a previous provider can send some mail to the wrong place.

  3. 03

    Add each MX record

    Type MX, name @ (the bare domain), the priority and the mail server hostname. Do not enter an IP address.

  4. 04

    Test

    Run the MX lookup or nslookup -type=MX example.com 1.1.1.1 and send a test message from an outside account.

What breaks MX records?

MX target is a CNAME

RFC 2181 forbids it. Some servers resolve it anyway, others bounce mail.

Hostname without an address record

The MX name must resolve to an A or AAAA record or delivery fails.

Mixed old and new providers

Two providers at similar priorities split mail between mailboxes.

What should you verify after changing MX records?

  • Only the new provider hostnames remain, with the priorities the provider specified
  • Every MX hostname resolves to an A or AAAA record and none is a CNAME
  • Send a test message into the domain from an outside mailbox and confirm it arrives
  • Send a reply back out to confirm outbound mail still works, since it depends on other records such as SPF
  • Keep the old mailboxes reachable until the old TTL has expired, so late mail is not lost

Which MX values do the big providers use?

  • Google Workspace, Microsoft 365 and similar providers each publish their own hostnames and priorities in their admin help
  • Copy them from the provider admin console for your domain; some providers give a value specific to your domain
  • Do not mix MX records from two providers on one domain unless you intend to split mail
  • After switching, lower-priority leftovers from the old provider are the usual cause of missing mail

Common questions

What does MX stand for in DNS?

MX stands for mail exchanger. An MX record lists the hostnames of the servers that receive email for a domain, together with a priority number that sets the order senders try them in.

Which MX priority is used first?

The lowest number is tried first. A server at priority 10 is preferred over one at 20. If several records share the same number, senders pick among them more or less evenly.

Can an MX record point to an IP address?

No. The MX value must be a hostname, and that hostname must resolve through an A or AAAA record. A bare IP address in the MX field is invalid.

Do I need an MX record if I do not use email?

Not required, but a null MX record (0 and a single dot) tells senders immediately that the domain accepts no mail, so they do not retry for days. RFC 7505 defines it.

How long does an MX record change take?

Senders cache the old MX set for its TTL, so the switch completes within that time, commonly an hour or less if the TTL was short. Lower the TTL a day before the move to shorten the overlap.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.