An MX (mail exchange) record is a DNS record that names the servers that receive email for a domain.
An MX record tells the rest of the internet where to deliver email for your domain. When someone sends a message to hello@example.com, their mail server looks up the MX records for example.com, finds the mail server listed there, and hands the message to it.
Each MX record has two parts: a priority number and a hostname. For example, 10 mail.example.com means "deliver to mail.example.com, with priority 10".
How MX records work
When a mail server has a message to deliver, it:
- Looks up the MX records for the domain after the @ sign.
- Sorts them by priority, lowest number first.
- Looks up the IP address of that hostname using its A record.
- Connects and delivers the message. If that server doesn't answer, it tries the next priority.
Lower numbers are tried first. Records with the same priority share the load. A backup mail server is usually given a higher number, such as 20, so it only receives mail when the main server is unavailable.
Why MX records matter for your website and email
MX records are what let your website and your email live in different places. Your website can stay on your web host while email runs on Google Workspace or Microsoft 365, simply by pointing the MX records at that provider. It also means you can switch email providers without moving your website.
If your MX records are missing or wrong, email to your domain bounces or vanishes, even though your website keeps working perfectly.
Common MX record mistakes
- Pointing an MX record at an IP address. MX records must point to a hostname, not an IP.
- Pointing an MX record at a CNAME. The hostname should have its own A record.
- Leaving old records behind after switching providers, so some mail goes to the old server.
- Editing the wrong DNS zone. If your nameservers point elsewhere, changes at your registrar have no effect.
- Forgetting SPF, DKIM and DMARC, which aren't MX records but are needed for good email deliverability.
How to check your MX records
You can look up MX records with an online DNS lookup tool, or from a terminal with dig MX example.com (macOS and Linux) or nslookup -type=mx example.com (Windows). Changes usually show up within a few hours, depending on the record's TTL, though they can take up to 48 hours to reach everyone.