I am looking to incorporate a domain name lookup facility in my website to make sure if a domain is available or not. The only api I could find on the net is http://www.domaintools.com/api/docs/domain-search/ . But this is paid. Is there any other api available which might be cheaper / free.

I am working with php, query.

  • Suggest @Jacek's answer - but may be helpful if you say which language you're working in for more appropriate suggestions of libraries/etc. :)
    – TZHX
    Oct 25, 2011 at 12:05
  • @TZHX - updated my answer Oct 25, 2011 at 12:51

5 Answers 5


You can simply do DNS queries yourself. You would just have to always start at top (so called root servers) and work your way down the domain name, to be sure it does exist. Don't know what language you're using, but most languages out there have apropriate libraries for the job. Sure it requires some knowledge about DNS system itself, but since you are querying DNS system directly, you can be sure it is and will remain free.

  • 5
    +1 - there's definitely features for this in C#/VB (for ASP) in the System.Net namespace. PHP also has a dns_get_record function. Python has it in the socket namespace... so whatever language you use, there'll almost certainly be a core library providing DNS features.
    – TZHX
    Oct 25, 2011 at 12:02
  • This will tell if you the name resolves, but not who owns it. Also, I'm not sure what the advantage of this would be over just querying your computer's configured caching DNS server (i.e. just doing a normal DNS lookup). Oct 25, 2011 at 12:07
  • @DeanHarding Well... the question was how to find if a domain does exist or not, not who owns it. And as for the normal DNS lookup, client computers do a lot of DNS caching (even browsers have their own cache to save some time and bandwith) which might (under some circumstances) provide you with a false answer. Direct querying will always be true. Oct 25, 2011 at 12:19
  • DNS is not a reliable source of truth. It's possible to register a domain name without a DNS record. Also existing DNS records might point to names which are free again. Mar 12, 2016 at 20:36

The WHOIS protocol is free and a number of servers exist which you can query. I would suggest you actually start at the wikipedia page, because it's got a fairly good introduction and pointers to further information.


I don't know if there is a free one, but you can always write your own. Within your code, submit a form to for example http://www.whois.net/ and scrap the resulting HTTP response. On that particular website, when the domain is free it shows "Domain name is not currently registered. Available for you now!". Look for this value in the response. If you find this string it means that the domain is already taken (then you can scrap additional information on who registered the domain), otherwise it is free. It is your choice then to either return a true/false value or more detailed information if you want to scrap more data when the domain is taken.

It's really only a few lines of code. Although if there is a free API, by all means, use it.

  • I notice whois.net block you if they notice you are sending many request. Others like network solutions put a token on the request page. So don't think this method will work.
    – user836026
    Feb 16, 2014 at 16:22

A domain is available or not may mean two different concepts

  1. Domain is available for registration
  2. Domain has a valid presence on DNS system (eg. has a website, can accept email etc.)

You mention about domaintools, hence probably you are interested in concept 1 mentioned above.

The most reliable way to find out whether a domain is available for registration or not is to query whois server for that TLD or ccTLD. Query to whois servers is always free. Although there may be strict limitations as to how many queries can be made per min/hour etc.

Finding out availability based on DNS is not reliable. It is possible that a domain may not have nameservers set with the registrars, in that case the response from DNS server would be "domain does not exists" though the domain is not available for registration.

ProgrammableWeb has a good collection of domain related apis here.


DNS is is not a reliable source of information. You can register a domain name without any DNS record.

Whois is the best you can do. The authoritative list of whois servers can be found at IANA. Unfortunately every Whois server speaks its own dialect. I compiled this Whois server list for you, where you also have a pattern to identify if a Whois server response indicates an available domain name.

If you don't want to update your local copy of that list I can recommend my Whois API. The PHP client is whois-api-php:

$whoisApi = new whoisServerList\WhoisApi("apiKey");
echo $whoisApi->isAvailable("example.net") ? "available" : "registered";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.