How to Add MX Records in Cloudflare
Add or replace MX records in Cloudflare so your domain receives email: exact values for Google Workspace and Microsoft 365, and the mistakes that lose mail.
October 3, 20263 min readCloudflare · MX Records · DNS
The short answer. Open the DNS records in Cloudflare, add one record of type MX for each mail server your email provider lists, with host
@, the mail server name and its priority. Remove old MX records that point to a previous provider.
What MX Records Do
MX records say which servers accept email for your domain. Senders pick the server with the lowest priority number first and fall back to the next. A domain with no MX records, or with the wrong ones, cannot receive mail.
Check Where Your DNS Is Managed
A record only works at the company that answers DNS for the domain, which is not always the one you bought it from. Cloudflare serves DNS only when the domain’s nameservers are two Cloudflare ones (they end in ns.cloudflare.com). The domain’s Overview page shows Active when that is the case.
The MX Record to Add
| Field | Value |
|---|---|
| Type | MX |
| Name | @ |
| Mail server | smtp.google.com |
| Priority | 1 |
| TTL | Leave TTL on Auto. |
smtp.google.com priority 1
Use the exact values your mail provider gives you. Two common ones:
| Mail provider | Mail server | Priority |
|---|---|---|
| Google Workspace | smtp.google.com | 1 |
| Microsoft 365 | example-com.mail.protection.outlook.com (your domain, with dashes instead of dots) | 0 |
Providers with several servers give a list. Add one MX record for each, with the priority they specify.
Step by Step in Cloudflare
Step 1. Open the domain
Sign in to the Cloudflare dashboard and click the domain on the Websites page.
Step 2. Open DNS Records
In the left menu choose DNS, then Records.
Step 3. Add a record
Click Add record. The form opens above the list.
Step 4. Enter the MX record
Choose MX as the type and fill in the fields:
- Name:
@ - Mail server:
smtp.google.com - Priority:
1 - TTL: Leave TTL on Auto.
The value to copy:
smtp.google.com priority 1
Step 5. Save
Click Save. Cloudflare shows the record in the list at once.
Change or Replace MX Records
To switch mail provider, delete the old MX records and add the new ones. Mixed providers split mail between two inboxes, and some of it is lost. Click Edit at the end of the row to change it, and Delete inside that panel to remove it. Click Save.
Do the change when you can test it right away: send a mail from outside and check it lands. Update the SPF record to allow the new provider too, see the SPF guide for Cloudflare.
Common Mistakes
- Leaving the old provider’s MX records in place. Mail then arrives at either provider, depending on the sender.
- Typing an IP address as the mail server. It must be a host name.
- Entering the mail server with your domain appended, or a trailing dot the form does not want. Enter it exactly as given, and look at how it appears in the list.
- Mixing up the priority. The lowest number is tried first, so
0or1beats10. - Forgetting SPF. New mail servers also need to be allowed to send, otherwise outgoing mail lands in spam.
- Switching on the orange cloud (Proxied) for a record that must resolve to its real value. TXT and MX records are never proxied, so check that the Proxy status column shows DNS only for any mail host record.
Check That It Worked
Look up the MX records of the domain. They should list the new servers only. Send a test email to the address from an outside account and confirm it arrives. Changes show up as caches expire, usually within minutes for a record and up to two days for nameservers, see how long DNS propagation takes.
More Cloudflare DNS Guides
- How to Add a DMARC Record in Cloudflare
- How to Add an SPF Record in Cloudflare
- How to Add a TXT Record in Cloudflare
- How to Change Nameservers in Cloudflare
The same task elsewhere: Namecheap, GoDaddy, Hostinger, Squarespace.
Menu names last checked October 2026. Providers rename things now and then; if a label differs, look for the closest match.
Keep email working after the switch.
The Domain Hub checks the mail setup of your domains, MX, SPF and DMARC, and tells you when one is missing or changes.
Open the Domain Hub