# What is the MX record?

The MX record (Mail Exchange Record) is a type of DNS entry that defines which mail server is responsible for receiving email for a given domain. It ensures that incoming emails are properly routed to the correct server.

## What is the MX record?

DNS records are stored in zone files – simple text files that contain all the entries for a zone managed by a specific server. When a client sends a request, the server retrieves the relevant information from this file. There are different types of DNS entries, each with its own function. The abbreviation MX stands for **Mail Exchange**, which hints at its function. An MX record tells email clients which [mail server](https://www.ionos.co.uk/office-solutions/email-server "E-Mail-Server von IONOS") is responsible for receiving messages for a given domain via DNS.

A domain typically includes multiple servers. In addition to the web server that hosts the website, there may be [FTP](https://www.ionos.co.uk/digitalguide/server/know-how/file-transfer-protocol/) servers and one or more mail servers. These are accessed through different subdomains. The MX record helps identify which subdomain handles email traffic for the domain. The sending mail server usually performs this check automatically.

Note The [Domain Name System](https://www.ionos.co.uk/digitalguide/server/know-how/domain-name-system/) supports many different resource record types, each enabling various functions within the system. For example, [A and AAAA records](https://www.ionos.co.uk/digitalguide/hosting/technical-matters/a-record/) are used for name resolution.

### What are the fields and syntax of an MX record entry?

Each DNS record contains several fields of information. In addition to the name of the mail server, other details are included:

- &lt;name&gt;: Domain name
- &lt;ttl&gt;: Time to live refers to how long the information remains valid
- &lt;class&gt;: Type of network
- &lt;type&gt;: Type of DNS record (MX, in this case)
- &lt;priority&gt;: Lower values indicate higher priority
- &lt;rdata&gt;: Resource data (mail server name)

**Domain names** are always specified using [Fully Qualified Domain Names (FQDN)](https://www.ionos.co.uk/digitalguide/domains/domain-administration/fqdn-fully-qualified-domain-name/), which end with a full stop. An FQDN shows the **complete path**, from the smallest subdomain to the root server. Since the root remains unnamed, **the domain name ends with a full stop**.

**Time to live** (TTL) determines how long a client can store the information in its cache. This helps avoid outdated entries. Once TTL expires, the record must be requested again. TTL is defined in seconds and is often set at the beginning of the zone file for the entire zone rather than in each individual entry.

The **class field** is now largely obsolete, as only the Internet (IN) is in use. Older network types like Hesiod (HS) and Chaos (CH) are no longer operational. For this reason, the field is either omitted or set to IN.

**Priority** is specific to MX records. Many administrators use multiple mail servers to ensure reliability and distribute traffic. Lower numbers indicate higher priority – email is delivered to the server with the lowest value first. If that server is unavailable, the next one in line is used.

The **data field** contains the name of the mail server in FQDN format. All fields are listed in a single line, and the entry ends with a line break, not a special character.

### An example of an MX record

Let’s take a look at the fictional domain `example.com`. A valid email address might be `user@example.com`. When an email is sent, the sender’s mail server queries DNS for `example.com`. The zone file might look like this:

```none
$TTL 1200
example.com.	IN	A		93.184.216.34
example.com.	IN	MX	10	mail1.example.com.
example.com.	IN	MX	10	mail2.example.com.
example.com.	IN	MX	50	mail3.example.com.
```

As you can see here, **the TTL value applies to the entire zone**, so it is only listed once. The first entry is an A record linking the domain to an [IP address](https://www.ionos.co.uk/digitalguide/server/know-how/what-is-an-ip-address/). The three MX records specify mail servers with different subdomains.

Mail servers 1 and 2 have equal priority levels (`10`), so email traffic is distributed evenly between them. Mail server 3, with a lower priority level, is only used as a fallback.

## What are some security aspects to note when setting up MX records?

Security is a key consideration when configuring MX records. You must never point MX records directly to IP addresses – they need to reference FQDNs, which are then resolved using A or AAAA records. Additionally, using a [CNAME](https://www.ionos.co.uk/digitalguide/hosting/technical-matters/cname-record/) entry as the target of an MX record is not permitted, as it **violates DNS standards** and can cause delivery failures. The target mail servers must be properly configured and reachable via DNS to avoid **errors or message loss**.

To prevent spam and [spoofing](https://www.ionos.co.uk/digitalguide/server/security/what-is-spoofing/), it’s also essential to implement **SPF, DKIM, and DMARC**:

- SPF ensures that only authorised servers can send emails on behalf of a domain.
- DKIM adds a digital signature to messages to prevent tampering.
- DMARC instructs receiving servers how to handle emails that fail SPF or DKIM checks.

## How to set up MX Records

If you’re using [Google Workspace](https://www.ionos.co.uk/digitalguide/startup/productivity/google-g-suite/) or [Microsoft 365](https://www.ionos.co.uk/digitalguide/e-mail/technical-matters/what-is-microsoft-365/) for business email, configuring the correct **MX record** in your domain’s DNS zone is essential. This ensures reliable email delivery to the provider’s servers.

## How to set up an MX record with Google Workspace

To route emails through [Google Workspace](https://www.ionos.co.uk/digitalguide/e-mail/technical-matters/collaboration-tools-a-comparison-of-the-best-solutions/), you need to add the official Google mail server as an **MX record** in your domain’s DNS zone. This can be done by following these steps:

1. Delete all existing MX records.
2. Add the following MX record for Google’s mail server:

```none
@	IN	MX	1	smtp.google.com.
```

3. Log in to the Google Admin Console with your admin account. In the domain settings, enable Gmail for the domain whose **MX record** you want to update.

It can take up to 72 hours for the changes to take effect.––

## How to set up an MX record in Microsoft 365

To configure an **MX record** for Microsoft 365, follow these steps:

1. Delete all existing **MX records**.
2. Log in to the Microsoft 365 Admin Center. Go to **Show all** -&gt; **Settings** -&gt; **Domains**. Here you will find the **MX record** to be used.
3. Copy the **MX record** provided, add it to your hosting provider’s DNS settings, and save the changes.

Note If you’re a IONOS customer, you can [adjust your MX records to use IONOS mail servers](https://www.ionos.com/help/index.php?id=19640 "MX Records Adjustment – IONOS Help"). If you prefer to [use your IONOS domain with an external mail server](https://www.ionos.co.uk/help/domains/configuring-mail-servers-and-other-related-records/using-a-domain-with-another-providers-mail-servers-editing-mx-records/ "Use IONOS Email with External Servers – IONOS Help"), that’s also possible.

## How to check the MX record

To check an **MX record**, use one of several online tools. [Google’s Public DNS](https://dns.google "Public DNS by Google") is a convenient option. On the homepage, simply enter the domain whose MX records you want to look up. On the results page, change the Record Type from **A** to **MX**. You don’t need to modify the EDNS Client Subnet or DNSSEC settings. The EDNS Client Subnet helps speed up DNS responses by including part of the requester’s IP address, while DNSSEC (Domain Name System Security Extensions) ensures the integrity of the response – making sure the information hasn’t been altered or spoofed by a malicious third party.

[![Image: DNS Lookup with Google](https://www.ionos.co.uk/digitalguide/fileadmin/_processed_/c/1/csm_google-dns-lookup-mx-record_9732d4dd8b.webp "DNS Lookup with Google")](https://www.ionos.co.uk/digitalguide/fileadmin/DigitalGuide/Screenshots_2025/google-dns-lookup-mx-record.jpg) With Google's free DNS service, you can also carry out an MX record lookup. / Source: https://dns.google.com/. The results will list the mail server under ‘Answer,’ along with the FQDN under ‘Data’ and the priority value priority of 10. The ‘Type’ field will show the number 15, which indicates an **MX record**. Each DNS record type is assigned a number by the [Internet Assigned Numbers Authority (IANA)](https://www.ionos.co.uk/digitalguide/server/know-how/everything-you-need-to-know-about-iana/).

Tip Prefer to avoid using tools from major tech companies? You can also check MX records using the [MX Lookup from MXToolBox](https://mxtoolbox.com/MXLookup.aspx "MX Lookup at MXToolBox"), a widely trusted, independently run tool.


This is a markdown version of: [https://www.ionos.co.uk/digitalguide/e-mail/technical-matters/mx-record/](https://www.ionos.co.uk/digitalguide/e-mail/technical-matters/mx-record/) for AI/LLM consumption.