Learn
What is an MX record?
An MX record, short for mail exchanger record, is the DNS entry that tells the rest of the internet which server receives email for your domain. When someone emails [email protected], their mail server looks up the MX record for yourcompany.com and delivers to the server it names. Change the MX record and your mail goes somewhere else.
Updated
How does an MX record work?
An MX record works as a forwarding instruction published in DNS, the internet's address book. When someone sends you email, this happens in a few seconds:
- The sender's mail server reads the domain after the @ in your address: yourcompany.com.
- It asks DNS for the MX records of yourcompany.com.
- DNS answers with one or more server names, each with a priority number.
- The sender's server connects to the server with the lowest number and hands over the message.
- If that server doesn't answer, it tries the next, and keeps the message queued and retries later if none do.
The MX record points to a server name, never an IP address directly; that name has its own address records. This is why providers can move their servers without you changing anything.
What does an MX record look like?
An MX record has a name, a priority and the mail server it points to. RFC 1035 defines the priority as a 16-bit "preference" where "lower values are preferred". In a DNS settings screen, a typical record looks like this:
| Field | Example | What it means |
|---|---|---|
| Type | MX | A mail exchanger record |
| Name or host | @ | The domain itself (yourcompany.com) |
| Priority | 1 | Try this first; lower numbers win |
| Value or points to | smtp.google.com | The server that receives the mail |
| TTL | 3600 | Seconds other servers may remember this answer |
Google Workspace now uses a single MX record, smtp.google.com with priority 1; domains set up before 2023 may still have older values beginning "aspmx", which Google says keep working. Microsoft 365 gives each domain its own value ending in mail.protection.outlook.com, shown in the admin center.
What does MX priority mean?
MX priority sets the order in which sending servers try your mail servers, lowest first. RFC 5321, the email delivery standard, says the preference "MUST be used in sorting if more than one such record appears" and that "lower numbers are more preferred than higher ones".
| Setup | Records | What happens |
|---|---|---|
| One server | 1 smtp.provider.example | All mail goes there |
| Main and backup | 10 mx1.provider.example, 20 mx2.provider.example | mx1 gets the mail; mx2 only when mx1 can't be reached |
| Shared load | 10 mx1.provider.example, 10 mx2.provider.example | Sending servers spread mail across both |
The actual numbers don't matter, only their order: 1 and 5 behave exactly like 10 and 50.
How do you check your MX records?
You check MX records with a DNS lookup. On a Mac or Linux terminal, run dig MX yourcompany.com +short; on Windows, nslookup -type=mx yourcompany.com. Free web tools that look up DNS records do the same in a browser.
What you see tells you who receives your mail. Values ending in google.com mean Google Workspace; mail.protection.outlook.com means Microsoft 365. If you see your old provider after switching, the change hasn't been made or hasn't spread yet.
How do you change your MX records?
You change MX records at your DNS host, usually the registrar where you bought the domain. Changing them moves where new mail arrives, so do it in order:
- Set up the new provider first, with every mailbox created, so nothing arrives at an address that doesn't exist yet.
- Lower the TTL on the current MX records a day ahead, to an hour or less, so the switch takes effect quickly.
- Replace the old MX records with the new provider's. Delete the old ones; don't leave them alongside.
- Follow your registrar's format: some want a full stop after the name (smtp.google.com.), some take the priority on the same line.
- Check with a lookup, then send a test message from an outside address.
- Keep the old provider for a few days while straggling mail, sent before the change spread, arrives there.
What MX record mistakes are most common?
Most MX problems come from a few mistakes:
- Old records left in place, so some mail still goes to the previous provider.
- An IP address as the value. MX records must point to a host name.
- A typo in the server name, which bounces every message.
- Switching before mailboxes exist, so the first messages bounce.
- Confusing MX with the website: MX records don't affect where your site is hosted.
- Forgetting authentication: changing provider also means updating SPF and DKIM, or mail you send may be marked as spam.
What is a null MX record?
A null MX record says a domain never receives email. RFC 7505 defines it as a single MX record with priority 0 and a server name of just ".", which can't be a real host. Sending servers then reject mail to that domain at once instead of retrying for days. It's useful for domains you own only for a website or to protect a brand, and it pairs well with an SPF record of v=spf1 -all so nobody can send as that domain either.
How does Mojobase handle MX records?
When Mojobase hosts email on your own domain, its domain page shows the MX record to add, alongside SPF, DKIM and DMARC, and checks each one for you, so you can see when mail will start arriving. If you keep Gmail or Outlook and connect them instead, your MX records stay exactly as they are: mail still arrives at Google or Microsoft, and Mojobase reads it from there. More on business email on your own domain, and the full move in how to set up business email.
Further reading
- RFC 5321: Simple Mail Transfer Protocol (section 5.1, locating the target host), IETF
- RFC 1035: Domain names, implementation and specification (MX RDATA format), IETF
- RFC 7505: A Null MX No Service Resource Record, IETF
- Set up MX records for Google Workspace, Google Workspace Admin Help
- Add a domain to Microsoft 365, Microsoft Learn
Questions people ask
What does MX stand for?
Mail exchanger. An MX record names the mail exchanger, the server that accepts incoming email, for a domain. The record type is defined in RFC 1035, one of the original DNS standards, and its use for mail delivery in RFC 5321.
What does the number in an MX record mean?
It's the priority, or preference. When a domain has several MX records, sending servers try the lowest number first and move to higher numbers only if that server can't be reached. The standard says lower numbers are preferred.
How long does an MX record change take?
Often minutes, sometimes a few hours. Other servers keep the old answer until its TTL, the time-to-live set on the record, runs out. Lowering the TTL a day before switching providers makes the change take effect faster.
Can I have MX records for two providers at once?
Not in a useful way. Sending servers deliver to the lowest-priority server that answers, so mail ends up with one provider and only reaches the other when the first is down. Running two mail systems needs routing set up inside one of them.
Does an MX record affect my website?
No. The website is found through A, AAAA or CNAME records, and email through MX records. You can change your email provider without touching your website, and the other way round.
What happens if a domain has no MX record?
Sending servers fall back to the domain's own address record, treating it as an implicit MX. If there's no mail server there, delivery fails. A domain that never receives mail can publish a null MX, a single record pointing to ".", to say so.