Skip to content

MX Record

Also known as: Mail exchanger record, Mail exchange record, MX

A DNS record that names the mail servers that accept email for a domain, each with a priority number. Sending servers try the lowest number first.

Last updated:

What is an MX record?

An MX record (mail exchanger record) tells the rest of the internet which servers accept email for a domain. When someone sends a message to [email protected], their mail server looks up the MX records of example.com, picks a server from the list and delivers the message to it over SMTP. Without MX records (or the fallback described below), a domain cannot receive mail.

Each MX record has two parts: a priority number and a host name. Here are gmail.com's MX records, as dig returned them on 12 November 2026:

dig +short MX gmail.com
10 alt1.gmail-smtp-in.l.google.com.
20 alt2.gmail-smtp-in.l.google.com.
40 alt4.gmail-smtp-in.l.google.com.
5 gmail-smtp-in.l.google.com.
30 alt3.gmail-smtp-in.l.google.com.

Resolvers return the records in any order. The priority is what counts: senders try gmail-smtp-in.l.google.com (5) first, then the others in order of their numbers.

How senders use MX records

RFC 5321, the SMTP standard, sets the rules. A sending server sorts the MX records by priority, lowest first, and tries each in turn until one accepts the message; servers with equal priority are tried in random order to spread the load. If a domain has no MX records at all, the sender treats the domain's own address (its A or AAAA record) as the mail server.

That fallback is why a domain that does not accept email should publish a null MX: a single record with priority 0 and the target ".", defined in RFC 7505. It tells senders not to try. example.com, the domain reserved for documentation, publishes one:

dig +noall +answer MX example.com
example.com.		300	IN	MX	0 .

Rules an MX record has to follow

  • It points to a name, never an address. The target is a host name with its own A or AAAA record.
  • The target must not be an alias. RFC 2181 says an MX record must not point to a name that is a CNAME.
  • It belongs on the domain people mail. For [email protected] the record is on example.com, not on www.example.com.

How to look up MX records

Our DNS lookup tool returns a domain's MX records with its other records, and names the mail provider behind them (Google, Microsoft and other common hosts). From a terminal, use dig MX example.com on macOS or Linux, or nslookup -type=mx example.com on Windows.

MX records only say where mail for a domain should go. Whether a message really came from that domain is a separate check, made with SPF, DKIM and DMARC records, and the path a message took is in its headers, which our email header analyzer reads. The sending server's own address should also have a matching PTR record, which large mail providers check before accepting mail.

Frequently Asked Questions

Enter the domain in our DNS lookup tool, which lists its MX records and names the mail provider behind them. On the command line, run dig MX followed by the domain on macOS or Linux, or nslookup -type=mx followed by the domain on Windows. Look up the bare domain (example.com), not www.
It is a preference: sending servers try the server with the lowest number first and move to higher numbers only if it does not answer. Servers with the same number share the load. The values themselves do not matter, only their order, so 5 and 10 work the same as 1 and 2.
Sending servers fall back to the domain's own A or AAAA record and try to deliver mail to that address, as RFC 5321 specifies. A domain that should never receive mail can say so outright with a null MX record, a single MX with priority 0 and a target of ".", defined in RFC 7505.
No. An MX record must point to a host name, and that name must have its own A or AAAA record. RFC 2181 also rules out pointing an MX record at a name that is a CNAME alias. Some DNS hosts accept either mistake without complaint, but mail delivery can fail intermittently.
As long as the old record's TTL, the caching time set on it. A record with a TTL of 3600 can be cached for up to an hour by resolvers that already looked it up. Lowering the TTL a day before a mail migration makes the switch faster.
Because your mail is hosted there. Google Workspace and Microsoft 365 each publish the MX values their customers must add, so a domain's MX records reveal its mail provider. Our DNS lookup tool names the provider for the common ones.