MX record
Learn what a DNS MX record is, how it directs email to the correct mail servers using priorities, common setups (Google Workspace, Microsoft 365, custom), lookup methods, and troubleshooting tips.
TL;DR
An MX record (Mail Exchange) tells other mail servers where to deliver email for your domain (e.g., user@example.com).
It points to one or more mail server hostnames with a priority number — lower number = higher priority (tried first).
Multiple MX records provide redundancy and failover.
example.com for MX records.The target hostname in an MX record must have its own A or AAAA record pointing to the actual mail server IP.
dig example.com MXnslookup -type=MX example.comNAME TTL CLASS TYPE PRIORITY VALUE
example.com. 3600 IN MX 10 mail.example.com.Basic custom setup
example.com. MX 10 mail.example.com.
mail.example.com. A 192.0.2.1With backup
example.com. MX 10 primary-mail.example.com.
example.com. MX 20 backup-mail.example.com.Google Workspace (typical)
example.com. MX 1 aspmx.l.google.com.
example.com. MX 5 alt1.aspmx.l.google.com.
example.com. MX 5 alt2.aspmx.l.google.com.
example.com. MX 10 alt3.aspmx.l.google.com.
example.com. MX 10 alt4.aspmx.l.google.com.Microsoft 365
example.com. MX 0 example-com.mail.protection.outlook.com.| Feature | MX | A / AAAA | CNAME |
|---|---|---|---|
| Purpose | Direct email delivery | IP address mapping | Domain alias |
| Priority | Yes (lower = better) | No | No |
| Multiple allowed | Yes | Yes | No |
| Points to | Domain name | IP address | Domain name |
| Required for email | Yes | Indirect (via MX target) | No |
→ See also: A Record, TXT Record (for SPF/DKIM/DMARC)
Related: A Record · TXT Record · DNS Basics