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 onexample.com, not onwww.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.