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
- Log into Cloudflare at dash.cloudflare.com
- Select your domain from the dashboard
- Click DNS in the left sidebar (or DNS > Records)
- 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:
- Find existing MX records in the DNS records list
- Click Edit on each record
- Click Delete and confirm
- 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
- Click Add record
- Select MX from the Type dropdown
- 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)
- Name:
- Click Save
- Repeat for each MX record your provider requires
Adding Google Workspace MX Records
Add these five MX records for Google Workspace:
| Name | Mail Server | Priority |
| @ | aspmx.l.google.com | 1 |
| @ | alt1.aspmx.l.google.com | 5 |
| @ | alt2.aspmx.l.google.com | 5 |
| @ | alt3.aspmx.l.google.com | 10 |
| @ | alt4.aspmx.l.google.com | 10 |
Add each record separately. Cloudflare will display them sorted by priority.
Adding Microsoft 365 MX Records
Microsoft 365 typically requires one MX record:
| Name | Mail Server | Priority |
| @ | yourdomain-com.mail.protection.outlook.com | 0 |
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:
-
Use our MX lookup tool to verify records appear. With Cloudflare, this should work within minutes.
-
Send a test email from an external account to confirm delivery.
-
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:
- Go to Email > Email Routing
- Disable routing for your domain
- Delete any Cloudflare-added MX records
- 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.,
mailnotmail.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