What Is an MX Record (Mail Exchanger)? A Complete Guide
If you’ve ever set up email for a domain — Google Workspace, Microsoft 365, or a self-hosted mail server — you’ve had to add an MX record. Here’s what it actually does.
The short version
An MX (Mail Exchanger) record — also called a mail exchanger record — is a DNS record that tells the internet which server is responsible for accepting email sent to addresses at your domain. When someone sends mail to you@yourdomain.com, the sending server doesn’t guess where to deliver it — it looks up your domain’s MX records first.
What an MX record looks like
A typical MX record has three parts: the domain, a priority number, and a mail server hostname.
yourdomain.com. 3600 IN MX 10 mail.yourdomain.com.
Broken down:
- yourdomain.com. — the domain the record applies to
- 3600 — the TTL (time to live), in seconds, before resolvers should re-check the record
- MX — the record type
- 10 — the priority (also called “preference”)
- mail.yourdomain.com. — the hostname of the mail server
How priority actually works
This trips people up constantly: lower priority numbers are preferred. A record with priority 10 is tried before one with priority 20.
yourdomain.com. MX 10 mail1.yourdomain.com.
yourdomain.com. MX 20 mail2.yourdomain.com.
Here, mail1 is the primary — sending servers try it first. If it’s unreachable, they fall back to mail2. This is how mail systems build in redundancy without any special configuration on the sending side; it’s purely a function of how MX priority is defined.
If two records share the same priority, sending servers are free to pick between them (often randomly, or round-robin), which is a simple way to spread load across multiple servers.
Why MX records point to hostnames, not IP addresses
An MX record’s value must be a hostname (like mail.yourdomain.com), never a raw IP address. That hostname then needs its own A (or AAAA) record pointing to an actual IP. This indirection means you can change your mail server’s IP address without touching the MX record itself — you just update the A record.
MX record vs A record
People often mix up the MX record and the A record because they work together. An A record maps a hostname to an IPv4 address (mail.yourdomain.com → 203.0.113.10). An MX record says which hostname receives email for the domain (yourdomain.com → mail.yourdomain.com). A sending server reads the MX record first, then looks up that hostname’s A (or AAAA) record to get the IP it connects to.
| MX record | A record | |
|---|---|---|
| Answers | Which server receives email for this domain? | What IP address does this hostname use? |
| Value | A hostname plus a priority number | An IPv4 address |
| Used for | Email delivery only | Websites, mail servers, any hostname |
| Can point to an IP? | No — hostnames only | Yes — that is its job |
So an MX record never replaces an A record: every mail server named in your MX records needs a working A record of its own. When you check an MX A record pair, confirm both halves: the MX record points to the right hostname, and that hostname’s A record points to the right IP.
Common real-world MX setups
Google Workspace domains typically use a single MX record:
yourdomain.com. MX 1 smtp.google.com.
(Older Google Workspace setups sometimes still show five aspmx.l.google.com records with priorities 1, 5, 10, 10, 10 — both are valid depending on when the domain was set up.)
Microsoft 365 domains typically look like:
yourdomain.com. MX 0 yourdomain-com.mail.protection.outlook.com.
How to check a domain MX record
You don’t need command-line tools to check a domain’s MX records — use a free MX tool such as the MX Lookup tool to see a domain’s MX records and priorities in your browser. For a step-by-step walkthrough of interpreting the results, see How to Check MX Records.
If you’re configuring outbound mail infrastructure alongside your MX setup — for example, warming up a new sending domain or mailbox before running cold email or sales outreach — MailPilot can help warm up mailboxes and monitor deliverability once your DNS is in place.