What is MX Record?
Also known as: Mail Exchange Record
A DNS resource record that delegates email delivery to one or more mail servers for a domain, using numeric priority values to indicate preference.
An MX (Mail Exchange) record is a type of resource record in the Domain Name System (DNS) that specifies which mail servers are responsible for accepting email messages on behalf of a domain. It is defined in RFC 1035 and updated by RFC 7505. Each MX record contains a preference number (also called priority) and the hostname of a mail server. Lower preference numbers indicate higher priority; the sending mail server will try the lowest-numbered server first, then fall back to higher-numbered servers if the first is unreachable. If multiple servers share the same preference value, the sender can choose among them in any order, typically by random selection for load balancing.
The record type was introduced to decouple the email receiving path from the domain's host addresses. Without MX records, email is often directed to the A or AAAA record of the domain apex, but MX records allow operators to specify mail servers on entirely different hosts or domains. The destination hostname in an MX record must resolve to one or more A or AAAA records; CNAME aliases are not permitted by the standard (RFC 2181). The wildcard MX record (e.g., *.example.com) is not recommended for mail routing because it can cause loops and unpredictable behavior.
In the wider email stack, MX records are queried during SMTP message transfer. When a Mail Transfer Agent (MTA) needs to deliver a message to user@example.com, it first asks DNS for the MX records of example.com. If no MX records exist, the MTA falls back to the A or AAAA record of the domain apex. After obtaining the server list, the MTA connects to port 25 (or 465/587 for submission) of the chosen server to deliver the message. Administrators commonly use multiple MX records with different priorities to provide redundancy and failover, a practice called secondary MX or backup MX.
Key facts
- MX records use a 16-bit preference number; lower values are tried first.
- The target hostname in an MX record must resolve to A or AAAA records, not CNAMEs.
- RFC 7505 (2015) introduced 'Null MX' record (MX 0 .) to formally indicate that a domain does not accept email.
- Service-specific SRV records are not a substitute for MX in standard SMTP routing.
How it works in practice
Related terms
References
More in DNS
A Record
A DNS resource record that maps a hostname to a 32-bit IPv4 address. It is the most fundamental record type for translating domain names to numeric addresses on the Internet.
AAAA Record
A DNS resource record that maps a hostname to a 128-bit IPv6 address, analogous to the A record for IPv4.
Authoritative DNS
An authoritative DNS server holds the definitive resource records for a specific domain and responds to queries with the final answer for that zone, not a cached copy.
CAA Record
A CAA (Certification Authority Authorization) DNS record lets domain owners specify which certificate authorities are permitted to issue SSL/TLS certificates for their domain.
CNAME Record
A DNS record that maps an alias hostname to the true or canonical hostname, allowing multiple names to resolve to the same IP address without duplicating A or AAAA records.
DNS
The Domain Name System (DNS) is a hierarchical, distributed naming system that translates human-readable domain names (like example.com) into IP addresses and other resource records used by internet protocols.
DNS Anycast
DNS Anycast uses one IP address served from multiple geographically distributed nameservers; queries are routed to the nearest or healthiest node, improving resilience and reducing latency.
DNS Caching
DNS caching stores resolved domain name query results for the specified TTL duration to avoid repeated queries to upstream authoritative servers.
DNS Hijacking
DNS hijacking is an attack or misconfiguration that returns forged DNS responses, causing users to connect to attacker-controlled hosts instead of the intended server.
DNSSEC
DNSSEC (DNS Security Extensions) add cryptographic digital signatures to DNS records, enabling resolvers to verify that responses have not been tampered with or spoofed.