MX Record Lookup
Find any mail server instantly.
Look up the MX records for any domain and see exactly which mail servers handle its incoming email — with priority, hostname, and TTL. No sign-up required.
Everything You Need to Inspect Mail Servers
Live DNS queries, priority-sorted results, and a clean JSON API — built for developers and deliverability engineers alike.
Live DNS Query
Results come directly from authoritative DNS servers in real time — not from a cached database.
Priority-Sorted Results
MX records are returned sorted by priority ascending so you always see the preferred server first.
Full Mail Routing Detail
Each record includes priority, fully-qualified hostname, and TTL for complete mail routing context.
Email Deliverability Audits
Instantly spot missing or misconfigured MX records — the top cause of email delivery failures.
Fraud Detection Signal
Identify domains with no MX records or MX records pointing to free consumer email providers.
Simple JSON API
A single REST endpoint, predictable response shape, and no SDK required to get started.
MX Record API Documentation & Code Examples
A single REST endpoint returns all MX records for any domain, sorted by priority. Predictable JSON, no SDK required — ready to integrate in minutes.
GET /api/v1/dns/mx/{domain}?api_key={key}
curl "https://ip-api.io/api/v1/dns/mx/gmail.com?api_key=YOUR_API_KEY"
{
"domain": "gmail.com",
"mx_records": [
{
"priority": 5,
"hostname": "gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 10,
"hostname": "alt1.gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 20,
"hostname": "alt2.gmail-smtp-in.l.google.com.",
"ttl": 300
}
]
}
GET /api/v1/dns/mx/{domain}?api_key={key}
const res = await fetch(
"https://ip-api.io/api/v1/dns/mx/gmail.com?api_key=YOUR_API_KEY"
);
const data = await res.json();
for (const record of data.mx_records) {
console.log(record.priority, record.hostname); // 5, "gmail-smtp-in…"
}
{
"domain": "gmail.com",
"mx_records": [
{
"priority": 5,
"hostname": "gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 10,
"hostname": "alt1.gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 20,
"hostname": "alt2.gmail-smtp-in.l.google.com.",
"ttl": 300
}
]
}
GET /api/v1/dns/mx/{domain}?api_key={key}
import requests
res = requests.get(
"https://ip-api.io/api/v1/dns/mx/gmail.com",
params={"api_key": "YOUR_API_KEY"}
)
data = res.json()
for record in data["mx_records"]:
print(record["priority"], record["hostname"])
{
"domain": "gmail.com",
"mx_records": [
{
"priority": 5,
"hostname": "gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 10,
"hostname": "alt1.gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 20,
"hostname": "alt2.gmail-smtp-in.l.google.com.",
"ttl": 300
}
]
}
GET /api/v1/dns/mx/{domain}?api_key={key}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"https://ip-api.io/api/v1/dns/mx/gmail.com?api_key=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = json_decode(curl_exec($ch));
foreach ($data->mx_records as $record) {
echo $record->priority . " " . $record->hostname;
}
{
"domain": "gmail.com",
"mx_records": [
{
"priority": 5,
"hostname": "gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 10,
"hostname": "alt1.gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 20,
"hostname": "alt2.gmail-smtp-in.l.google.com.",
"ttl": 300
}
]
}
GET /api/v1/dns/mx/{domain}?api_key={key}
require 'net/http'
require 'json'
uri = URI('https://ip-api.io/api/v1/dns/mx/gmail.com')
uri.query = URI.encode_www_form(api_key: 'YOUR_API_KEY')
res = Net::HTTP.start(uri.hostname, use_ssl: true) { |h| h.get(uri) }
data = JSON.parse(res.body)
data['mx_records'].each { |r| puts "#{r['priority']} #{r['hostname']}" }
{
"domain": "gmail.com",
"mx_records": [
{
"priority": 5,
"hostname": "gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 10,
"hostname": "alt1.gmail-smtp-in.l.google.com.",
"ttl": 300
},
{
"priority": 20,
"hostname": "alt2.gmail-smtp-in.l.google.com.",
"ttl": 300
}
]
}
Built for real-world applications
From deliverability audits to fraud signals — MX record lookups that fit your workflow.
Email Deliverability
Verify that a domain's mail infrastructure is correctly configured before sending. Missing or misconfigured MX records are the top cause of email delivery failures.
Fraud Detection
Flag domains that claim to be businesses but point their MX records to free consumer email providers, or have no MX records at all — a strong signal for phishing and fake signups.
DNS Migration Verification
When switching email providers, confirm that MX record changes have propagated correctly. Check before and after migration to ensure the new server is live and the old one is removed.
MX Record Lookup FAQs
Common questions about MX records and mail server lookups.
What is an MX record?
An MX (Mail Exchange) record is a DNS record that specifies the mail servers responsible for receiving email on behalf of a domain. Every domain that receives email must have at least one MX record pointing to a mail server. MX records include a priority value — lower numbers mean higher priority — so that email is delivered to the preferred server first, with fallback servers used if the primary is unavailable.
How do I look up MX records?
You can look up MX records using the free tool on this page — just enter any domain name and click Look Up MX. The tool queries the live DNS system and returns all MX records with their priority and hostname. For programmatic access, use the ip-api.io MX Record API at GET https://ip-api.io/api/v1/dns/mx/{domain} which returns results as JSON.
What does MX record priority mean?
MX record priority is a number that determines which mail server email is sent to first. Lower numbers mean higher priority. For example, if a domain has two MX records with priorities 10 and 20, sending mail servers will try the priority-10 server first. If it is unavailable, they fall back to priority 20. Multiple records with the same priority value receive mail in round-robin fashion for load balancing.
Can MX records help detect phishing or fraud?
Yes. MX records reveal which email provider a domain uses. If a domain claims to be from a major enterprise but its MX records point to a free consumer email provider, that is a fraud signal. Domains with no MX records cannot receive email at all, which is suspicious for any domain claiming to be a legitimate business. Combining MX record lookups with domain age checks and IP fraud detection gives you a strong anti-phishing signal.
Is the MX record lookup tool free?
Yes, the interactive MX record lookup tool on this page is completely free with no sign-up required. API access for developers requires a paid subscription.
Simple, transparent pricing
Start small, scale as you grow. No hidden fees.
Look up mail servers programmatically
Retrieve MX records, priorities, hostnames, and TTLs for any domain — no sign-up required for the free tier.