How to Add MX Records in Cloudflare - Step-by-Step Guide

Complete guide to adding and managing MX records in Cloudflare DNS for Google Workspace, Microsoft 365, and other email providers.

Cloudflare's DNS management is fast, reliable, and has an intuitive interface for managing MX records. Whether you're setting up email for the first time or migrating to a new provider, this guide covers everything you need.

Before You Start

Make sure you have:

  • Access to your Cloudflare account with the domain added
  • The MX records from your email provider (hostname and priority)
  • Your domain's DNS managed through Cloudflare (not just proxied)

If you're switching email providers, Cloudflare's fast propagation (often under 5 minutes) is an advantage, but you should still verify changes before decommissioning your old provider.

Accessing DNS in Cloudflare

  1. Log into Cloudflare at dash.cloudflare.com
  2. Select your domain from the dashboard
  3. Click DNS in the left sidebar (or DNS > Records)
  4. You'll see all DNS records for your domain

MX records appear in the list with "MX" in the Type column. Cloudflare shows them with the mail server and priority.

Adding MX Records

Step 1: Remove Old MX Records (If Needed)

If you're switching email providers:

  1. Find existing MX records in the DNS records list
  2. Click Edit on each record
  3. Click Delete and confirm
  4. Repeat for all old MX records

Cloudflare propagates fast

Cloudflare's DNS changes typically propagate within minutes. Don't delete old records until you're ready to add new ones immediately after.

Step 2: Add New MX Records

  1. Click Add record
  2. Select MX from the Type dropdown
  3. Fill in the fields:
    • Name: @ for your root domain (or subdomain if needed)
    • Mail server: The hostname from your email provider
    • Priority: The priority number from your email provider
    • TTL: Auto is fine (Cloudflare uses 5 minutes by default)
  4. Click Save
  5. Repeat for each MX record your provider requires

Adding Google Workspace MX Records

Add these five MX records for Google Workspace:

NameMail ServerPriority
@aspmx.l.google.com1
@alt1.aspmx.l.google.com5
@alt2.aspmx.l.google.com5
@alt3.aspmx.l.google.com10
@alt4.aspmx.l.google.com10

Add each record separately. Cloudflare will display them sorted by priority.

Adding Microsoft 365 MX Records

Microsoft 365 typically requires one MX record:

NameMail ServerPriority
@yourdomain-com.mail.protection.outlook.com0

Replace yourdomain-com with your domain (hyphens instead of dots). Find the exact value in your Microsoft 365 admin center under Settings > Domains.

Adding Other Email Provider MX Records

Common configurations for other providers:

Zoho Mail:

@ → mx.zoho.com (priority 10)
@ → mx2.zoho.com (priority 20)
@ → mx3.zoho.com (priority 50)

ProtonMail:

@ → mail.protonmail.ch (priority 10)
@ → mailsec.protonmail.ch (priority 20)

Fastmail:

@ → in1-smtp.messagingengine.com (priority 10)
@ → in2-smtp.messagingengine.com (priority 20)

Always verify current values in your email provider's documentation.

Cloudflare-Specific Features

Fast Propagation

Cloudflare's global network propagates DNS changes in under 5 minutes for most locations worldwide. This makes email migrations smoother than with slower DNS providers.

Email Routing (Cloudflare Email)

Cloudflare offers its own email routing service that can forward email to other addresses. If you enable this:

  • Cloudflare adds its own MX records automatically
  • These may conflict with third-party email provider records
  • Disable Email Routing if you want to use external MX records

To check: Go to Email > Email Routing and ensure it's disabled if you're using another email provider.

DNS-Only Mode for MX

MX records don't use Cloudflare's proxy (the orange cloud). They're always DNS-only, which is correct—email can't route through HTTP proxies.

TTL Settings

Cloudflare's "Auto" TTL is typically 5 minutes, which is ideal for:

  • Fast propagation of changes
  • Quick failover if you need to modify records
  • Normal email operations

You can set custom TTL if needed, but Auto works well for most cases.

Verifying Your Changes

After adding MX records:

  1. Use our MX lookup tool to verify records appear. With Cloudflare, this should work within minutes.

  2. Send a test email from an external account to confirm delivery.

  3. Check your email provider's dashboard for setup verification tools.

Troubleshooting Cloudflare MX Issues

Email Not Working After Adding Records

  • Verify Email Routing is disabled (if using external provider)
  • Check for typos in mail server hostnames
  • Confirm all required MX records were added
  • Wait 15 minutes and test again

Conflict With Cloudflare Email Routing

If you previously used Cloudflare Email Routing:

  1. Go to Email > Email Routing
  2. Disable routing for your domain
  3. Delete any Cloudflare-added MX records
  4. Add your email provider's MX records

Records Show in Cloudflare But Not Externally

  • DNS changes propagate from Cloudflare within minutes
  • External DNS servers may still have old records cached
  • Wait for their cache to expire (based on previous TTL)
  • Some networks have aggressive caching; this resolves with time

"Name" Field Format

  • Use @ for the root domain (example.com)
  • Use subdomain names directly (e.g., mail not mail.example.com)
  • Cloudflare auto-appends your domain to the name

Priority Confusion

  • Lower priority number = tried first
  • Priority 1 is higher priority than priority 10
  • If your provider specifies priorities, use their exact values

Additional Records for Email

MX records tell servers where to deliver email. For complete email setup, you also need:

SPF Record (TXT) Authorizes servers to send email from your domain:

Type: TXT
Name: @
Content: v=spf1 include:_spf.google.com ~all

(Adjust the include for your email provider)

Check your SPF at spfrecordcheck.com.

DKIM Record (TXT or CNAME) Your email provider generates this. It validates email signatures. Test at dkimtest.com.

DMARC Record (TXT) Defines authentication policy:

Type: TXT
Name: _dmarc
Content: v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com

Check at dmarcrecordchecker.com.

Monitor Your MX Records

Checking once is good. Monitoring continuously is better. The Email Deliverability Suite watches your SPF, DKIM, DMARC, and MX records daily and alerts you when something breaks.

Never miss an MX issue

Monitor your SPF, DKIM, DMARC and MX records daily. Get alerts when something breaks.

Start Monitoring