c-ares/c-ares logo

c-ares/c-ares

Free

A C library for asynchronous DNS requests

FreeFree tier
Type
Open Source

About c-ares/c-ares

c-ares is a modern DNS (stub) resolver library written in C that provides asynchronous query interfaces while abstracting the complexities of the underlying DNS protocol. Originally designed for applications needing non-blocking DNS lookups or parallel queries, it aims to serve as a better DNS resolver than those provided by the operating system. The library is MIT licensed, builds with any C89 compiler, and runs on Linux, FreeBSD, OpenBSD, macOS, Solaris, AIX, Windows, Android, iOS, and many other platforms. It emphasizes security with safe parsers and data builders, and is continuously validated through static/dynamic analysis and OSS Fuzz. Actively maintained for over 20 years, c-ares follows the latest DNS RFCs and modern C coding standards.

Key Features

Asynchronous DNS query interface
Non-blocking and parallel DNS resolution
C89 compatible and MIT licensed
Cross-platform support (Linux, FreeBSD, OpenBSD, macOS, Solaris, AIX, Windows, Android, iOS, and more)
Strong security focus with safe parsers and data builders
Continuously fuzzed via OSS Fuzz and tested with static/dynamic analyzers
Actively maintained for over 20 years with adherence to latest DNS RFCs and C standards

Pros & Cons

Pros
  • Asynchronous design avoids blocking the calling application
  • Portable across many operating systems and compilers
  • MIT license allows use in both free and commercial software
  • Strong security practices reduce vulnerability to common DNS attacks
  • Well-maintained with decades of development and testing
Cons
  • Stub resolver only, not a full recursive DNS server
  • Requires integration into C/C++ codebase; no built-in scripting interface
  • Memory management is manual, as typical for C libraries

Best For

Network applications requiring non-blocking DNS lookupsApplications needing multiple DNS queries in parallelEmbedded systems or environments where system resolver is insufficientAny C/C++ project that wants a modern, secure DNS stub resolver

FAQ

What is c-ares?
c-ares is a modern C library for asynchronous DNS resolution. It provides non-blocking query interfaces and abstracts DNS protocol details.
What license does c-ares use?
c-ares is MIT licensed, making it suitable for both free and commercial software.
Which platforms are supported?
c-ares runs on Linux, FreeBSD, OpenBSD, macOS, Solaris, AIX, Windows, Android, iOS, and many other operating systems.
Is c-ares secure?
Yes, c-ares has a strong focus on security with safe parsers and data builders. It is constantly validated by static/dynamic analyzers and fuzzed by OSS Fuzz.
How does c-ares differ from the system resolver?
c-ares aims to be a better DNS resolver than system resolvers by providing asynchronous operation, cross-platform consistency, and enhanced security practices.
Is c-ares still actively maintained?
Yes, c-ares has been actively maintained for over 20 years and continues to be updated with latest DNS RFCs and modern C standards.