MX Record: What Mail Exchange Records Are, Priority Rules, and Examples

A Mail Exchange (MX) record is a DNS resource record that directs incoming email for your domain to the specific mail servers responsible for accepting it. Sending mail servers query your MX record to find your email provider's hostname before resolving its IP address. The priority number of an MX record controls server preference and failover order.

SPF which servers may send DKIM proves mail is intact DMARC policy + reports Receiver checks all three pass INBOX fail SPAM / REJECT DMARC requires at least one pass (SPF or DKIM) with domain alignment
Email routing and authentication: how MX directs inbound mail while SPF, DKIM, and DMARC secure delivery

What Is the Structure of an MX Record in DNS? (Fields and Syntax)

An MX record (DNS Type 15) routes inbound messages in accordance with the Simple Mail Transfer Protocol (SMTP) by mapping a domain name to one or more prioritized mail exchange hostnames. The record contains 5 zone fields: the domain host (@), record type (MX), Time to Live (TTL), a priority integer (0 to 65535), and the target mail server hostname. The table below defines each component.

example.com.    3600    IN    MX    10 mail1.example.com.
example.com.    3600    IN    MX    20 mail2.example.com.
FieldExample ValueTechnical Constraints & Description
Host / Name@The root domain receiving email. Setting Host to @ routes mail for user@example.com.
Record TypeMXDNS Type 15, designated exclusively for routing incoming email to designated mail exchangers.
Priority10An unsigned 16-bit integer (0 to 65535) where lower numbers indicate higher preference.
Targetmail1.example.com.A canonical hostname resolving directly to an A or AAAA record, never a raw IP or CNAME.
TTL3600Time to Live (TTL) in seconds specifying how long resolvers cache the routing answer.

The Host field uses @ because standard email addresses format destinations as user@example.com. Publishing an MX record on a subdomain like mail routes only messages addressed to user@mail.example.com. Live records can be inspected with the MX Record Lookup, while setup procedures appear in How to Add MX Records for Email.

How Do Mail Servers Use MX Records to Deliver Email? (5 Steps)

To deliver email to alex@example.com, the sender's outbound Mail Transfer Agent (MTA) executes 5 sequential DNS lookup and SMTP connection steps.

Inbound message dispatch proceeds through this standardized sequence:

  1. Extract the recipient domain (example.com) from the address and query DNS for all MX records published on that hostname.
  2. Sort the returned MX records in ascending numerical order by their priority value, placing the lowest number at the top.
  3. Resolve the target mail server hostname of the lowest-numbered MX record into an IP address via its A Record or AAAA Record.
  4. Open a Simple Mail Transfer Protocol (SMTP) TCP connection on port 25 to that IP, negotiate STARTTLS, and transmit the message.
  5. Retry delivery against backup MX hosts if the primary server times out, spooling messages for 48 to 72 hours if all endpoints fail.

Sending mail servers automatically fall back to attempting SMTP delivery directly to the domain root A or AAAA address web server IP under the standard SMTP specification when a domain publishes zero MX records. Domains that never receive email prevent this unintended web server traffic by publishing an explicit Null MX record (0 .).

How Do MX Priority (Preference) Numbers Work? (Failover vs Load Balancing)

The priority number in an MX record is a 16-bit integer from 0 to 65535 where a lower number always indicates a higher preference (0 is highest priority), allowing administrators to configure 3 distinct routing patterns.

Organizations utilize these 3 architectural priority layouts:

  1. Primary and Backup Failover (Distinct Priority Numbers, e.g., 10 and 20): Senders query priority 10 first and contact priority 20 only if the primary server is offline. Numerical increments allow inserting intermediate gateways later without renumbering existing records, and backup MX servers require the exact same anti-spam filtering as the primary MX server so spammers cannot bypass filters via higher-numbered hosts.
  2. Equal-Priority Load Distribution (Identical Priority Numbers, e.g., 10 and 10): Assigning identical priority numbers directs senders to randomize selection, distributing inbound mail evenly across multiple mail processing nodes.
  3. Single Anycast MX Endpoint (Modern Cloud Providers, e.g., Priority 0 or 1): Providers like Microsoft 365 and Google Workspace manage redundancy at the global Anycast layer behind a single hostname.

Configuring appropriate priority levels prevents traffic bottlenecks during peak message volumes and supports uninterrupted failover during unexpected mail server outages.

Standard MX Record Examples for Major Email Providers (Google, Microsoft 365, Zoho, Proton)

Every email provider supplies its own authoritative mail exchanger hostnames and priority values for your DNS zone. The table below lists production MX records for 6 major email platforms plus the Null MX configuration.

Email ProviderHostPriorityTarget Mail Server ValueRecommended TTL
Google Workspace (Modern 2023+)@1smtp.google.com3600 (1 hr)
Google Workspace (Legacy 5-Record)@1, 5, 5, 10, 10aspmx.l.google.com (1), alt1/alt2 (5), alt3/alt4 (10)3600 (1 hr)
Microsoft 365 (Exchange Online)@0<tenant-key>.mail.protection.outlook.com3600 (1 hr)
Proton Mail (Custom Domain)@10, 20mail.protonmail.ch (10), mailsec.protonmail.ch (20)3600 (1 hr)
Zoho Mail@10, 20, 50mx.zoho.com (10), mx2.zoho.com (20), mx3.zoho.com (50)3600 (1 hr)
Fastmail@10, 20in1-smtp.messagingengine.com (10), in2 (20)3600 (1 hr)
Parked / Non-Receiving Domain (Null MX)@0. (Single root dot per RFC 7505)86400 (24 hr)

Publishing MX records from two email providers simultaneously splits inbound delivery unpredictably, causing incoming messages to bounce or misroute. For non-sending domains, publishing a Null MX record (0 .) informs worldwide MTAs that the domain accepts zero incoming email, stopping connection retries and bounce loops.

What Are the 3 Strict DNS Rules for MX Target Hostnames?

DNS and SMTP standards enforce 3 strict rules on every MX target hostname: the target cannot point to an IP address, cannot point to a CNAME alias, and cannot sit behind an HTTP reverse proxy.

Mail architecture requires strict adherence to these 3 technical prohibitions:

  1. An MX Record Never Points Directly to an IPv4 or IPv6 Address: Entering a raw IP address in the MX target field violates core DNS specifications. An MX record always specifies a fully qualified domain name resolving via its own A or AAAA record.
  2. An MX Target Hostname Never Points to a CNAME Record: Pointing an MX record to a CNAME alias is prohibited by email routing standards. Mail servers require direct terminal address records; alias chaining introduces lookup delays and delivery failures.
  3. Never Enable Cloudflare Orange Cloud Proxy on a Mail Hostname: Placing a mail server behind Cloudflare's proxy (Orange Cloud) replaces the true IP with an HTTP reverse proxy that blocks port 25 SMTP traffic. Administrators always keep mail server hostnames set to DNS Only (Grey Cloud).

Observing these target restrictions prevents connection drops and ensures worldwide mail transfer agents locate destination IP addresses without resolution delays.

How Do MX Records Connect to MTA-STS, SPF, DMARC, and Blacklists?

MX records control where inbound email is delivered, interacting directly with 4 email security and deliverability mechanisms: MTA-STS inbound encryption, the SPF mx mechanism, PTR reverse DNS, and DNSBL blacklists.

Email security engineering integrates these 4 interconnected components:

  1. MX Handles Inbound Mail; SPF, DKIM, and DMARC Handle Outbound Mail: An MX record directs incoming messages; it does not authorize outbound senders. Outbound authentication and spoofing defense require SPF Record, DKIM Explained, and DMARC.
  2. The mx Mechanism Inside SPF (v=spf1 mx -all): Including the mx mechanism authorizes the IP addresses of the domain's MX hosts to transmit outbound mail.
  3. Securing MX Connections with MTA-STS: Publishing an MTA-STS policy explicitly pins your valid MX hostnames and enforces strict TLS encryption to prevent downgrade attacks, verifiable via the MTA-STS Record Checker.
  4. Reverse DNS (PTR Record) and Blacklist Hygiene: Outbound email gateways operating on MX host IPs require matching PTR records and clean listings on spam databases, auditable with the MX and IP Blacklist Checker.

Integrating inbound MX records with these security layers protects organizational domains from impersonation and secures mail transfer across untrusted network paths.

How Do You Check and Troubleshoot Your Domain's MX Records?

To verify live MX records and diagnose incoming email delivery failures, run a browser-based lookup or terminal dig query to check for 4 common MX misconfigurations.

Querying your domain via terminal tooling reveals active mail exchangers:

# Linux / macOS terminal:
dig example.com MX +short

# Windows Command Prompt:
nslookup -type=mx example.com 1.1.1.1

Evaluate these 4 common root causes when diagnosing bounced incoming messages:

  1. Residual Legacy MX Records: Old mail exchanger records left behind during an email provider switch cause split delivery and bounced messages.
  2. Missing A or AAAA Records for Custom Mail Hosts: Pointing an MX record to mail.example.com fails if mail.example.com lacks a valid A or AAAA record.
  3. Apex CNAME Conflicts: Publishing a CNAME record at the zone apex (@) suppresses all MX records on the root domain, breaking email delivery.
  4. Unpropagated DNS Updates: Changing MX records without accounting for TTL expiration causes senders to query cached records until propagation completes.

Maintaining accurate MX records, priority numbers, and valid hostnames guarantees reliable inbound SMTP routing. Administrators can audit routing through MX Record Lookup, test encryption with the SMTP Connectivity and STARTTLS Tester, resolve delivery errors using MX Record Not Working?, and track propagation with the DNS Propagation Checker.

Frequently asked questions

Does a lower or higher MX priority number get used first?+

A lower number always has higher priority and is tried first. Sending mail servers contact priority 0 or 1 before priority 10, and only fall back to priority 20 or 50 if the lower-numbered primary server is offline.

Can I point an MX record directly to an IP address?+

No, DNS standards prohibit pointing an MX record directly to an IPv4 or IPv6 address. Always point your MX record to a hostname (such as mail.yourdomain.com), and create a separate A or AAAA record pointing that hostname to the IP address.

How many MX records should a domain have?+

Most domains publish between 1 and 5 MX records depending on their email provider. Modern Google Workspace (1 smtp.google.com) and Microsoft 365 require only 1 MX record, while providers like Proton Mail and Zoho use 2 to 3 records for backup failover. In production email deployments, we recommend following your provider's exact MX hostname recommendations and avoiding adding legacy secondary hosts from previous mail platforms.

What happens if I have MX records from two different email providers at the same time?+

Publishing MX records for two different inbox providers on the same domain splits or breaks your incoming email delivery. Sending servers route mail only to the lowest-priority provider (or randomly split messages if priorities match), causing lost emails. In practice, the most common migration pitfall occurs when teams leave old hosting MX entries active alongside new cloud mailbox records, causing unpredictable delivery failures across sending MTAs.

Last verified: 2026-11-22