A vs AAAA vs CNAME Records: Which DNS Record Should You Use?

Choosing a DNS record is easier when you first ask what the name should point to: an IP address or another hostname. A, AAAA, and CNAME records often appear in the same website setup, but they do different jobs. Using the wrong one can break a site, complicate a hosting change, or interfere with other records at the same name.

A Records Point to IPv4 Addresses

An A record connects a hostname to an IPv4 address. For example, www.example.com could have an A record pointing to 192.0.2.10. When the hosting provider gives you an IPv4 address, this is normally the record type to use. A hostname can have multiple A records, although simply listing several addresses does not guarantee health checks or automatic failover.

Use the address supplied for the actual service. A typo or old address can direct visitors to the wrong server even when the website itself is healthy. Our introductory article on how DNS finds a website explains where address records fit into the wider lookup process.

AAAA Records Point to IPv6 Addresses

An AAAA record has the same basic role for IPv6. A website that works over both IPv4 and IPv6 may publish A and AAAA records for the same hostname. However, only publish an AAAA record when the web server, firewall, and application are genuinely reachable over IPv6. Otherwise, some visitors may experience timeouts or inconsistent behaviour.

Adding IPv6 is therefore more than entering an address in the DNS control panel. Test the complete connection, including HTTPS, from an external IPv6 network. The ClouDNS overview of DNS record types provides a broader reference for A, AAAA, CNAME, and other common records.

CNAME Records Create Hostname Aliases

A CNAME record points one hostname to another hostname, rather than directly to an IP address. For example, www.example.com could be an alias for example.com. If the target’s address records change, the alias follows the target without needing a separate address update.

A CNAME is useful when a hosting or application provider gives you a hostname instead of an IP address. Enter that exact hostname as the target, and check that it resolves correctly. A CNAME is not an HTTP redirect: the browser can still display the original address after DNS resolution.

Know the CNAME Restrictions

At a given hostname, a CNAME cannot coexist with other standard DNS records. That matters for the zone apex, such as example.com, which needs SOA and NS records. A standard CNAME is therefore unsuitable there. Some DNS providers offer ALIAS, ANAME, or flattening features for apex-like behaviour; these are provider-specific mechanisms that publish address answers rather than a conventional apex CNAME.

Do not replace an MX or TXT record name with a CNAME without understanding the effect on email and verification. Check all existing records at the name before changing it.

Make Changes Deliberately

Before editing DNS, write down the current record, intended replacement, and rollback value. Allow for cached answers after the change; our guide to DNS TTL explains why an update is not instantly visible to every resolver. Then query the authoritative nameservers and test the website from outside your network.

In short, choose A for IPv4, AAAA for IPv6, and CNAME for an alias to another hostname. For the formal definition and limitations of CNAME records, see RFC 1034, section 3.6.2.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *