MX Record Lookup

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.

Try it live
Domain Query
● Checking…
MX Records
● Pending…
Primary Mail Server
● Pending…
API Response
{
"domain": "gmail.com",
"mx_records": [
{
"priority": 5,
"hostname": "gmail-smtp-in.l.google.com.",
"ttl": 300
}
]
}
Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
Features

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.

Developer Experience

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.

Fast JSON responses from live DNS queries
Records sorted by priority ascending
SDKs for JavaScript, Python, PHP, Ruby, Go
Consistent, versioned API structure
Read API Reference
Endpoint
GET /api/v1/dns/mx/{domain}?api_key={key}
Example Request
curl "https://ip-api.io/api/v1/dns/mx/gmail.com?api_key=YOUR_API_KEY"
Example Response
200
{
  "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
    }
  ]
}
Endpoint
GET /api/v1/dns/mx/{domain}?api_key={key}
Example Request
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…"
}
Example Response
200
{
  "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
    }
  ]
}
Endpoint
GET /api/v1/dns/mx/{domain}?api_key={key}
Example Request
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"])
Example Response
200
{
  "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
    }
  ]
}
Endpoint
GET /api/v1/dns/mx/{domain}?api_key={key}
Example Request
$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;
}
Example Response
200
{
  "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
    }
  ]
}
Endpoint
GET /api/v1/dns/mx/{domain}?api_key={key}
Example Request
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']}" }
Example Response
200
{
  "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
    }
  ]
}
Use Cases

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.

DNS Check Priority TTL

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.

MX Presence Provider Check Risk Signal

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.

Before/After Propagation Verification
FAQ

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.

Pricing

Simple, transparent pricing

Start small, scale as you grow. No hidden fees.

Small
€10 /month
100,000 geo IP requests / month
10,000 advanced email validation requests
MX record lookups included
Location, threat & time zone data
Email support
99.9% uptime SLA
Get started
Large
€49 /month
1,000,000 geo IP requests / month
100,000 advanced email validation requests
Unlimited MX record lookups
Full DNS API suite
SLA & uptime guarantee
All datasets
Custom integrations
Dedicated support
Get started

Look up mail servers programmatically

Retrieve MX records, priorities, hostnames, and TTLs for any domain — no sign-up required for the free tier.

> _
curl ip-api.io/api/v1/
mx/example.com
MX