DNS Lookup

What is an MX record?

The record that decides which server receives the email sent to your domain.

MX stands for Mail eXchanger. The MX record names the mail server responsible for accepting email sent to your domain.

An MX record has two parts: the mail server's priority and its name. When there are several MX records, the server with the lowest priority value is tried first.

A list of MX records with priority and target server columns

How does an MX record work?

When someone sends an email to alex@example.com, the sender's mail server asks DNS for the MX records of example.com. It sorts the list by priority, connects to the server with the lowest value and delivers the message. If that server doesn't answer it moves on to the next; if none answer, it queues the message and tries again later.

The MX record only affects incoming mail. Which server your mail is sent from is decided by your SPF and DKIM records, not by MX.

How do you create an MX record?

An MX record consists of a priority and a server name. For example:

example.com.   3600   IN   MX   10 mail.example.com.
example.com.   3600   IN   MX   20 backup.example.com.
  • 10 is the priority. The lower the number, the higher the priority.
  • mail.example.com is the mail server messages are delivered to. This value depends on which company hosts your email.
  • Sending servers try the MX records in order of priority.
  • If several MX records share the same priority, one is picked at random, which spreads the load across servers.

When adding an MX record in a panel you usually put @ in the "Name" field, the server name in "Value" and the number in "Priority". Whether you need a trailing dot after the server name depends on the panel; if unsure, leave it out and look the record up after saving.

MX values for common email services

The values below are for typical setups. Always use the value your provider shows for your own account.

ServiceMX record
Google Workspace1 smtp.google.com (older setups use aspmx.l.google.com plus alt1…alt4, which are still valid)
Microsoft 3650 example-com.mail.protection.outlook.com (generated for your domain)
Zoho Mail10 mx.zoho.com, 20 mx2.zoho.com, 50 mx3.zoho.com (zoho.eu in the EU data centre)
Fastmail10 in1-smtp.messagingengine.com, 20 in2-smtp.messagingengine.com
cPanel / Plesk hostingUsually 0 example.com or 10 mail.example.com

When changing email providers

  1. Verify your domain with the new provider and create the mailboxes.
  2. Lower the MX record's TTL a day in advance.
  3. Delete all old MX records and add the new ones.
  4. Update your SPF record for the new provider and add its DKIM key.
  5. Keep the old account open for a few days until you've moved your mail; messages arriving during the switch may collect there.

Null MX (if your domain doesn't receive mail)

If you never use your domain for email, you can say so explicitly. The "null MX" defined in RFC 7505 tells sending servers that mail can't be delivered to this address, so messages aren't pointlessly retried for days:

example.com.   3600   IN   MX   0 .

Combine it with a v=spf1 -all SPF record and a p=reject DMARC policy and your domain can't be used to send spoofed mail either.

Common mistakes

  • Putting an IP address in the MX value. An MX must point to a host name. Put the IP address in that host name's A record.
  • Pointing the MX at a CNAME. Under RFC 2181 the name an MX points to must not be a CNAME. Many servers tolerate it, but some reject the mail.
  • Switching email providers and leaving the old MX in place. Even with a higher priority number, if the new server is briefly unreachable, mail goes to the old server and is lost.
  • Adding the MX to the www subdomain. For alex@example.com the MX record belongs on example.com (@).
  • Forgetting the mail server's A record. If you use your own name like mail.example.com, that name needs an A record. Our lookup tool checks the IP address of every MX server.