Skip to main content

What is an MX record? Setup, examples and tips

Published on June 19, 2026 8 min read

An MX record decides which mail server receives email for your domain. Learn how an MX record works, how to set it up and how to avoid mistakes.

Flat vector illustration of a person beside an arrow-shaped signpost guiding an orange envelope to a row of blue mail servers, with a second path to a smaller backup server.

An MX record tells the internet which mail server should receive the email for your domain. If this record is set up incorrectly, your email arrives late or not at all. This article explains what an MX record is, how its structure and priority work, how to set it up and check it, and which mistakes to avoid. Whether you are setting up email for the first time or moving to a new provider such as Microsoft 365 or Google Workspace, you will then know exactly what to look for.

What is an MX record?

MX stands for "mail exchanger". It is a type of DNS record that specifies which mail server is responsible for receiving email for a domain. When someone sends a message to name@yourdomain.com, the sending server first looks up this record. It tells the server where to deliver the message.

The record is part of the Domain Name System (DNS), the system that translates domain names into the correct servers. The record type is defined in the DNS standard (RFC 1035) and is used by mail servers under the SMTP protocol (RFC 5321), the standard for sending email.

What the record does not do

An MX record only controls where incoming email goes. It does not decide where your website runs, because that is the job of the A record or AAAA record. It also says nothing about whether your email is genuine. For that you use SPF, DKIM and DMARC. Those settings complement the MX record, but are separate from it.

What does an MX record look like?

It consists of a few fixed parts that you will find in almost every DNS management screen:

  • Name (host): usually the domain itself, often shown as @ or as yourdomain.com.
  • Type: MX.
  • Priority (preference): a number from 0 to 65535 that sets the order.
  • Value (mail server): the full hostname of the mail server, for example mail.yourdomain.com.
  • TTL: how long the record may be cached, in seconds.

In a table, such a record looks like this:

Example of an MX record
NameTypePriorityValueTTL
@MX10mail.yourdomain.com3600

Priority explained

The priority, also called the preference, sets the order in which sending servers try your mail servers. A lower number has a higher priority and is tried first. A server with priority 10 therefore comes before a server with priority 20.

If you have several records with the same priority number, the sending server spreads the traffic roughly evenly across them. That lets you share the load. A record with a higher number often acts as a backup server: it is only used when the server with the highest priority cannot be reached.

The key rules

A valid MX record has to follow a few rules. If you ignore them, email can be delayed or fail to arrive at all.

  • Point to a hostname, not an IP address. The value is always a domain name, such as mail.yourdomain.com, and never an IP address like 192.0.2.10. That hostname must itself have a valid A record (IPv4) or AAAA record (IPv6).
  • Do not point to a CNAME. Under the DNS standard (RFC 2181), the value must not point to a CNAME record, in other words an alias. If you do this anyway, email delivery can fail silently. Always point to a hostname that has an A record or AAAA record.
  • Use a full hostname. In a raw DNS zone, the mail server often ends with a dot (mail.yourdomain.com.) to show that it is a complete name. In most control panels you enter the name without the dot and it is added automatically.
  • No port numbers. The record contains only a priority and a hostname, no port. Email between servers arrives on port 25 by default.

How to set up an MX record

You set it up with whoever manages the DNS for your domain. That is usually your hosting or domain provider. The exact screens vary by provider, but the steps are nearly always the same:

  1. Log in to the control panel of your hosting or domain provider.
  2. Open the DNS management, sometimes called "DNS settings" or "zone editor", for the right domain.
  3. Find the existing MX records. If you are moving from another email service, remove the old records first so that email does not go to the wrong server.
  4. Add a new record. Enter @ as the name (or leave it empty for the main domain), choose type MX, enter the mail server your email provider gives you and copy the priority number.
  5. Leave the TTL at its default value, for example 3600 seconds (one hour).
  6. Save it and wait for the change to take effect. This is called DNS propagation and can take a while.

Always set an explicit record. Without one, some mail servers fall back to the A record of your domain, but you cannot rely on that. If you use the email service of your own hosting provider, the correct value is often already set for you, or your provider gives it to you. Not sure what you need? Ask your provider before you change anything.

Examples per email service

The mail server you enter comes from whoever handles your email. Below are a few common examples. Always copy the exact values from the control panel of your email provider, because they can differ depending on your setup.

Email with your hosting provider

If you host your email with your hosting provider, the value usually points to a mail server within that same domain, for example mail.yourdomain.com. One record is then often enough. The provider normally sets this up automatically as soon as you create a mailbox.

Microsoft 365

Microsoft 365 uses one MX record per domain. The value looks like yourdomain-com.mail.protection.outlook.com, with a low priority (the setup wizard gives the exact value, often 0) and a TTL of 3600 seconds. You will find the precise hostname, known as the MX token, in the Microsoft 365 admin center under your domain settings.

Google Workspace

Since 2023, Google Workspace works with a single value: smtp.google.com with priority 1. The older setup with five records (ASPMX.L.GOOGLE.COM and four ALT servers) still works, but for new domains Google recommends the single record.

Common MX records per email service
ServiceMail server (value)Priority
Your own hosting providerfor example mail.yourdomain.com10
Microsoft 365yourdomain-com.mail.protection.outlook.com0 (low)
Google Workspacesmtp.google.com1

Checking the record

Want to know which value is currently active for a domain? You can check that easily with a command in the terminal or with an online tool. A few commonly used commands:

Commands to look up an MX record
SystemCommand
Linux or macOSdig MX yourdomain.com +short
Windowsnslookup -type=mx yourdomain.com
Linux or macOS (alternative)host -t mx yourdomain.com

Replace yourdomain.com with your own domain. The output shows the priority and the mail server or servers. Check that only the records you expect are present and that no old records have been left behind.

Common problems

Most email problems that involve mail routing come down to a handful of recurring mistakes. The table below lists the best known ones, with a solution.

Common problems and solutions
ProblemLikely causeSolution
Email does not arrive after a migrationOld records are still in placeRemove the old records and keep only the new ones
Mail delivery fails for no clear reasonThe value points to an IP address or a CNAMEPoint to a hostname with an A record or AAAA record
A change seems to have no effectThe old value is still cached (TTL)Wait until propagation is complete, usually within a few hours
Email goes to the wrong serverWrong priority or duplicate recordsCheck the priorities and remove any redundant records

Still stuck? Read our article on solving common DNS problems or get in touch with your provider.

With a correctly configured value, email for your domain arrives in the right place. After every change, check that only the intended records are active and give propagation a little time. Cannot work it out? Get in touch with support and we will take a look with you.

Frequently asked questions

What exactly does an MX record do?

An MX record tells sending mail servers which server they should send email to for your domain. Without a correct setting, other servers do not know where to deliver messages for your domain, so email does not arrive.

What does the priority in an MX record mean?

The priority is a number that sets the order in which mail servers are tried. A lower number takes precedence and is used first. With equal numbers the traffic is shared, and a higher number often serves as a backup server.

Can an MX record point to an IP address or a CNAME?

No. The value must point to a hostname that itself has an A record or AAAA record. An IP address or a CNAME (alias) is not allowed and can cause email not to be delivered.

How long does it take for a new MX record to work?

A change is usually active within a few minutes to a few hours, depending on the TTL and DNS propagation. In the worst case, allow up to 24 to 48 hours. If email still does not work after an hour, it is usually a configuration error rather than a delay.

Do I need multiple MX records?

Not necessarily. One record is enough to receive email. You use several to add a backup server or to share traffic. Many services, such as Microsoft 365, actually work with a single value.

What is a null MX record?

A null MX record is a special setting with the value "0 .", meaning priority 0 and a single dot. It signals that a domain does not receive email. You use it for domains that serve only a website and never need to receive email.

Does an MX record replace SPF, DKIM and DMARC?

No. It only controls where incoming email goes. SPF, DKIM and DMARC verify that outgoing email really comes from your domain. You need both for reliable email.

Prefer to talk to someone?

We are also happy to answer your questions personally. Schedule a free consultation or call us directly. We are glad to think along with you.

Stay up to date with recent developments! Subscribe and receive our newsletter Signing up... Thank you for subscribing! Something went wrong. Please try again later.