Perform real DNS queries for any domain using Cloudflare's secure DNS-over-HTTPS API. Get A, AAAA, MX, TXT, NS, CNAME, SOA records with TTL, response time, and full JSON output. Perfect for network admins, developers, and learners.
The Domain Name System (DNS) is the phonebook of the internet. It translates human-friendly domain names (like example.com) into machine-readable IP addresses (like 93.184.216.34). DNS also provides other records – mail servers, text policies, cryptographic keys, etc. A DNS lookup is the process of querying these records from a DNS resolver.
How a DNS query works (simplified):
Your application → Recursive resolver (e.g., 1.1.1.1) → Root server → TLD server → Authoritative server → Answer returned.
| Type | Purpose | Example |
|---|---|---|
| A | IPv4 address for a domain | google.com → 142.250.185.46 |
| AAAA | IPv6 address | google.com → 2607:f8b0:4005:805::200e |
| MX | Mail exchange servers (with priority) | 10 mail.protonmail.ch |
| TXT | Arbitrary text, often for verification (SPF, DKIM, etc.) | "v=spf1 include:_spf.google.com ~all" |
| NS | Authoritative name servers for the domain | ns1.google.com |
| CNAME | Alias (canonical name) pointing to another domain | www.example.com → example.com |
| SOA | Start of authority – administrative info (serial, refresh, etc.) | ns1.google.com. dns-admin.google.com. 2024031201 7200 1800 1209600 300 |
| PTR | Reverse lookup – maps IP to hostname (used for reverse DNS) | 1.0.0.127.in-addr.arpa → localhost |
| SRV | Service location (used by SIP, XMPP, etc.) | _xmpp._tcp.gmail.com → 5 0 5269 xmpp-server.l.google.com |
| CAA | Certification Authority Authorization – which CAs may issue certificates | 0 issue "letsencrypt.org" |
This tool uses the DNS-over-HTTPS (DoH) protocol defined in RFC 8484. Instead of raw UDP, we send a JSON-formatted request over HTTPS to Cloudflare's endpoint. This encrypts the query and prevents eavesdropping or manipulation by ISPs. The API returns a JSON object containing the Response Code (0 = NOERROR), Question, Answer (if any), Authority, and Additional sections. The Status field indicates success (0) or errors (e.g., NXDOMAIN = 3).
We parse the Answer array to display records. TTL (time-to-live) tells you how long the result may be cached. The resolver (Cloudflare) recursively walks the DNS tree starting from the root, but you only see the final answer.
api/dns-lookup.php on our server.
| Scenario | Record type | Why it matters |
|---|---|---|
| Website migration (change IP) | A / AAAA | Check if new IP is live worldwide (TTL dependent). |
| Email delivery issues | MX, TXT (SPF, DKIM) | Verify MX priorities and SPF includes your sending server. |
| Subdomain delegation | NS | Ensure child zone's name servers are correctly set. |
| Certificate issuance | CAA | Confirm which Certificate Authorities are allowed. |
| Reverse DNS setup for mail server | PTR | Many email servers require PTR to match HELO. |
A small business found their emails going to spam. Using this tool, they looked up the MX record of their domain and saw the correct mail server (priority 10). Then they checked TXT records: the SPF record was missing. After adding v=spf1 include:spf.protection.outlook.com -all (since they use Office 365), they re‑checked and the TXT appeared. Within 24 hours, email deliverability improved. The TTL indicated how long the change would take to propagate.
AD (Authentic Data) flag in the response header. If present in the raw JSON, it indicates the resolver validated the response.