What is an MX record? How email finds your inbox

An MX record is a DNS Mail Exchange record. It tells other mail servers which host accepts incoming email for your domain. If someone sends to hello@example.com, the sender looks up MX records for example.com, chooses the most-preferred reachable server, and opens an SMTP connection to deliver the message.

Updated July 14, 2026

What an MX record contains

example.com.  MX  10  mx1.mailprovider.com.
example.com.  MX  20  mx2.mailprovider.com.
Two MX destinations. The lower preference number is tried first.

Each record contains a preference value and a hostname. The hostname must resolve to an address that accepts mail; an MX target must not be a raw IP address. Providers often ask you to publish several records for capacity and redundancy.

People often call the number a priority. Technically SMTP calls it a preference, and lower numbers are more preferred. The practical rule is simple: 10 is tried before 20.

How sending servers choose an MX host

  1. Look up MX records for the recipient domain.
  2. Sort the reachable destinations by preference, lowest number first.
  3. If several hosts share the same preference, distribute attempts among them.
  4. Try a less-preferred host when the preferred one cannot be reached.
  5. Queue and retry temporary failures rather than treating every failed connection as a permanent bounce.

The exact retry behavior belongs to the sending server, so MX records do not guarantee instantaneous failover. A badly configured backup host can accept mail and then fail to relay it correctly, which is worse than simply letting the sender queue and retry.

MX records do not authorize outgoing mail

Your inbound and outbound providers may be different. A company might receive mail through Microsoft 365 while sending newsletters through Mailchimp and transactional mail through Amazon SES. Its MX records point only to Microsoft; SPF and DKIM must also authorize and sign for the outbound platforms.

Common MX record mistakes

  • Leaving old provider MX records active during a migration, causing some senders to deliver to the wrong system.
  • Reversing priority values and accidentally preferring a backup or verification host.
  • Pointing the MX value at an IP address instead of a hostname.
  • Proxying a mail hostname through a web-only CDN feature.
  • Publishing a hostname that has no usable A or AAAA record or no listening SMTP service.
  • Adding a backup server that is not configured with the same recipients and anti-spam controls.

How to check or change MX safely

Use the MX lookup to see the public result in preference order. Before a provider migration, copy the exact destinations and values from the new provider, lower DNS TTL ahead of the change if appropriate, verify that accounts exist at the destination, publish the full new set, and remove the old set as the provider instructs.

Afterward, query more than once during the old TTL window and send tests from an external mailbox. DNS visibility proves routing data exists; an actual delivered message proves the destination is accepting mail for your users. For a deeper look at equal values and failover, read MX record priority explained.

Sources and further reading

Common questions

Does every domain need an MX record?+

Only domains intended to receive email need working inbound routing. A domain that should never receive mail can publish a null MX record to state that explicitly.

Can an MX record point to an IP address?+

No. Its target is a hostname, and that hostname resolves to an IP address separately.

Does a lower MX number mean higher priority?+

Yes. Lower preference values are tried before higher values. Hosts with equal values are considered equally preferred.

Will changing MX records affect outgoing email?+

Not directly. MX controls inbound delivery. However, a provider migration often changes outbound systems too, so SPF, DKIM, and DMARC should be reviewed at the same time.