MX Records Explained: How Email Routing Works
Part of our guide to DNS Records Explained: A Complete Guide to Every Record Type.
What Is an MX Record?
An MX (Mail Exchange) record is a DNS record that tells the internet which mail servers are responsible for accepting email on behalf of your domain. Send a message to [email protected] and the sender's mail server queries DNS for the MX records of example.com, then delivers to the hostname those records point to. Think of MX records as the routing instructions that connect an email address to a real inbox server. The record type itself is part of the original DNS specification, RFC 1035, and SMTP relies on it for mail routing as described in RFC 5321.
MX records are just one piece of the DNS picture. If you want the full map of how A, CNAME, TXT, and MX records fit together, start with our pillar guide, DNS records explained. This article zooms in on email routing specifically, but it assumes the basics of how DNS lookups work as covered there.
How MX Priorities and Failover Work
Each MX record carries a priority number, sometimes called a preference value. Lower means higher priority, so a sending server always tries the lowest-numbered host first. When that server is unreachable, the sender falls back to the next-lowest priority, and so on down the list. This is the mechanism behind email failover: run a primary mail server alongside one or more backups that only receive mail when the primary is down.
If two MX records share the same priority number, sending servers distribute messages between them roughly evenly, which is a simple form of load balancing. Here is a typical setup with a primary server at priority 10 and a backup at priority 20:
| Priority | Mail host | Role |
|---|---|---|
| 10 | mail1.example-mail.com | Primary |
| 20 | mail2.example-mail.com | Backup/failover |
| 30 | mailbackup.example-mail.net | Secondary backup |
In this example, almost all mail flows to mail1 at priority 10. Only when mail1 cannot be reached does delivery shift to mail2, and mailbackup is a last resort.
MX Records Must Point to Hostnames, Not IPs
An MX record must point to a hostname, never directly to an IP address. That hostname then needs its own A record (for IPv4) or AAAA record (for IPv6) so the sending server can resolve it to an actual address. Point an MX record at a bare IP and delivery breaks; it is invalid and a frequent cause of trouble. The target hostname should also not be a CNAME, since RFC 5321 expects MX targets to resolve directly to address records.
This two-step resolution (MX to hostname, hostname to IP) is why a small typo in either record can quietly break inbound email. When you set up mail, confirm both the MX entry and the A record it depends on.
Common Providers Use Multiple MX Records
Hosted email providers almost always publish several MX records at different priorities for redundancy. Google Workspace and Microsoft 365, for example, both have you point your domain at their mail infrastructure using multiple MX hostnames so that mail keeps flowing even if one cluster is unavailable. When you configure either service, you copy the exact hostnames and priority values from their setup instructions rather than inventing your own.
Alongside MX records, these providers ask you to add authentication records. SPF, DKIM, and DMARC policies all live in TXT records explained, and they complement MX records: MX decides where mail is delivered, while those TXT records prove that mail leaving your domain is legitimate. Many "email not arriving" or "email going to spam" problems trace back to TXT authentication rather than the MX records themselves.
What Happens With No MX Record
When a domain has no MX record at all, RFC 5321 permits sending servers to fall back to the domain's A record and attempt delivery there. This is called implicit MX. In practice it is unreliable: many providers will not fall back, so mail simply bounces or is rejected. For any domain that needs to receive email, publish explicit MX records rather than leaning on fallback behavior.
How to Verify Your MX Records
After making changes, verify your MX records before assuming email works. Check that each MX hostname is spelled correctly, that priorities match your provider's instructions, and that every MX target resolves to a valid A record. DNS changes also take time to propagate, so a fresh edit may not be visible everywhere immediately. Our walkthrough on how to check DNS records covers reading MX output step by step.
The fastest way to see your live MX records, their priorities, and whether the target hostnames resolve is to run a lookup with our tool.
Run a Free DNS Check
Want to confirm your mail routing in seconds? Run a free DNS check to view your MX records, priorities, and supporting A records all in one place.
Frequently asked questions
What is an MX record?
An MX (Mail Exchange) record is a DNS record that tells sending mail servers which servers accept email for your domain. When someone emails [email protected], the sender looks up the MX records for example.com and delivers the message to the listed mail server. Without an MX record, email for the domain has nowhere defined to go.
What does the MX priority number mean?
The priority (also called preference) is a number that controls delivery order. A lower number means higher priority, so sending servers try the lowest-numbered MX host first. Higher-numbered records act as backups for failover if the primary is unreachable.
Why is my email not being delivered?
The most common causes are a missing or incorrect MX record, or an MX record pointing to a hostname that has no valid A record. Delivery can also fail when authentication is misconfigured, since SPF, DKIM, and DMARC policies (stored in TXT records) can cause receiving servers to reject or quarantine mail even when MX records are correct.