DNS Lookup
Time & Networking Tool
DNS Record Types
- A: IPv4 address record
- AAAA: IPv6 address record
- MX: Mail exchange record
- NS: Name server record
- TXT: Text record (SPF, DKIM, etc.)
- CNAME: Canonical name alias
- SOA: Start of authority
Queries are performed via Cloudflare's DNS-over-HTTPS API. Your IP is not logged.
Copied to clipboard!
lucide.createIcons();
async function lookup() {
const domain = document.getElementById('dns-domain').value.trim();
const type = document.getElementById('dns-type').value;
const result = document.getElementById('dns-result');
if (!domain) { result.textContent = 'Enter a domain name.'; return; }
result.textContent = 'Looking up...';
try {
const url = `https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(domain)}&type=${type}`;
const res = await fetch(url, { headers: { 'Accept': 'application/dns-json' } });
if (!res.ok) throw new Error('DNS query failed (' + res.status + ')');
const data = await res.json();
if (data.Status !== 0) {
result.textContent = 'DNS query returned error code: ' + data.Status;
return;
}
if (!data.Answer || data.Answer.length === 0) {
result.textContent = 'No records found for ' + domain + ' (type ' + type + ').';
return;
}
let html = `Found ${data.Answer.length} record(s)
`;
html += '| Type | TTL | Value |
';
for (const r of data.Answer) {
html += `| ${r.type} | ${r.TTL} | ${r.data} |
`;
}
html += '
';
result.innerHTML = html;
} catch(e) {
result.textContent = 'Error: ' + e.message;
}
}
document.getElementById('dns-lookup-btn').addEventListener('click', lookup);
document.getElementById('dns-domain').addEventListener('keydown', e => { if (e.key === 'Enter') lookup(); });
function showToast(msg) {
const toast = document.getElementById('toast');
const toastMsg = document.getElementById('toast-message');
toastMsg.textContent = msg;
toast.classList.add('show');
setTimeout(() => toast.classList.remove('show'), 2000);
}