What is an MX record? Mail servers, priority numbers and fallbacks
By TechCompare · Updated · How we check
Lower numbers win. A record of 10 mx1.example.com is tried before 20 mx2.example.com, and records with the same number share the load between them.
An MX record tells other mail servers where to deliver mail for a domain. Each one has two parts: a priority number and the hostname of a mail server. Senders try the lowest number first and only move up the list when that server doesn't answer. Without any MX record, a sender falls back to the domain's own address, which is rarely what you want.
How this is calculated
The priority (RFC 5321 calls it the preference) is a number from 0 to 65535. Only the order matters, so 10 and 20 behave the same as 1 and 2. When several records share the lowest number, senders pick among them at random, which spreads the mail out. A higher number is a backup that takes mail when the main servers can't.
The target has to be a hostname with its own A or AAAA record. It can't be an IP address, and RFC 2181 says it must not be an alias (CNAME). Plenty of servers follow an alias anyway, but some refuse, so mail can bounce for a few senders and not for others.
A domain with no MX record isn't cut off from mail. RFC 5321 tells senders to deliver to the domain's own A or AAAA address instead. To say a domain takes no mail at all, publish a null MX: one record with priority 0 and a target of a single dot (RFC 7505). Senders then bounce mail right away instead of retrying for days.
The DNS Lookup lists MX records by priority. Pick a few resolvers to compare, and a move to a new mail host shows up for every resolver once it has spread.
Verdict
Copy the MX records your mail provider gives you exactly, priorities included, and remove the old provider's records on the day you switch. Point each one at a hostname, never at an IP or a CNAME. If a domain never sends or receives mail, add a null MX next to an SPF record of v=spf1 -all, so nobody can use it for mail.
More DNS scenarios
Related guides
Frequently asked questions
What does the number in an MX record mean?
Can an MX record point to an IP address?
What is a null MX record?
Related tools
Subnet Calculator
Calculate network address, broadcast address, and usable IP ranges for IPv4/IPv6.
Use toolText Encoding Converter
Convert text to Base64, binary, hex, URL encoding and HTML entities, and back again.
Use toolJWT Decoder & Validator
Decode JWT headers and claims, check exp, nbf and iat, and verify signatures locally with your own key.
Use tool