Back to cheatsheets
Web Security
WHOIS / RDAP Domain Lookup
Query domain registration data via RDAP — registrar, dates, name servers, and status flags.
What you'll learn
- RDAP query (JavaScript)
- CLI WHOIS
How to use these snippets
- Click the Copy button next to any snippet to copy it to your clipboard.
- Paste the code into your project, IDE, or terminal.
- Replace placeholder values (like
example.comoryour-secret) with your actual data. - Review the code comments for important security notes and caveats.
- Try the interactive related tool to see the concept in action.
Code Snippets
Copy-paste code snippets
2 ready-to-use snippets for whois / rdap domain lookup. Click copy and paste into your project.
RDAP query (JavaScript)
async function rdapLookup(domain) {
// RDAP is the modern replacement for WHOIS
const res = await fetch(
`https://rdap.org/domain/${domain}`
);
const data = await res.json();
return {
registrar: data.events?.find(e =>
e.eventAction === 'registration')?.eventDate,
expiry: data.events?.find(e =>
e.eventAction === 'expiration')?.eventDate,
nameservers: data.nameservers?.map(n => n.ldhName),
status: data.status,
};
}
CLI WHOIS
# Basic WHOIS lookup
whois example.com
# RDAP via curl
curl -s https://rdap.org/domain/example.com | jq
# Domain age calculation
whois example.com | grep "Creation Date"
# Then: today - creation date = domain age
Tool
Related ShieldX tool
Try this concept hands-on with the interactive tool.
100% Free · No signup · No cost
Generate something unguessable right now
148 bits of entropy, a crack-time estimate you can trust, and a clipboard that clears itself after 30 seconds.
Part of the Toolly ecosystem · secure.toolly.site