A and AAAA Records Explained
Learn what A and AAAA records hold, how to publish them correctly and what happens when a name returns several addresses.
Key takeaways
- A holds a 32-bit IPv4 address and AAAA holds a 128-bit IPv6 address; a name can have both.
- A name can carry several records of one type, and clients may receive them in varying order.
- Publish an AAAA record only when the service really answers over IPv6, or some visitors will see delays or failures.
- Address records hold addresses only: no web paths, ports or other hostnames.
An A record maps a name to an IPv4 address. An AAAA record (said "quad A") maps a name to an IPv6 address. They are the records that actually tell a device where to connect, and almost every other kind of lookup ends in one of them.
If you are pointing a domain at a web server, you will create an A record with the server's IPv4 address, and an AAAA record too if the server is reachable over IPv6. The rest of this guide covers the details that decide whether it works for everyone.
What the records look like
In zone file form:
example.com. 3600 IN A 192.0.2.10
example.com. 3600 IN AAAA 2001:db8::10
www.example.com. 3600 IN A 192.0.2.10
www.example.com. 3600 IN AAAA 2001:db8::10 Each line has a name, a time to live in seconds, the class IN, the type and the address.
IPv4 addresses are written as four numbers from 0 to 255 separated by dots. IPv6 addresses are written as groups of hexadecimal digits separated by colons, with a run of zero groups shortened to ::. If that notation is new to you, see how to read and shorten an IPv6 address. The IPv4 to IPv6 representations tool shows related forms.
The name field in dashboards
DNS providers differ in how they ask for the name, and this trips up many first attempts.
| You want | Typical name field |
|---|---|
example.com itself | @ or left blank |
www.example.com | www |
shop.eu.example.com | shop.eu |
| Any name not otherwise listed | * |
Most dashboards append your domain automatically. Entering the full name in the field can create www.example.com.example.com. After saving, look at the full name the provider displays, then query it to confirm.
The bare domain, example.com, is often called the apex or root domain. A and AAAA records work there without restriction, unlike CNAME records.
Several addresses on one name
A name may have more than one record of the same type:
www 300 IN A 192.0.2.10
www 300 IN A 192.0.2.11
www 300 IN A 192.0.2.12 The group is called a record set. A resolver returns all of them, often rotating the order, and clients typically try one and may fall back to another. This is known as DNS round robin.
It spreads load roughly, with real limits. The DNS server does not know whether 192.0.2.11 is healthy unless your provider adds health checks. Caching means one resolver's users may all receive the same order for a while. And different clients choose differently. For dependable distribution and failover, use a load balancer.
Many hosted DNS services can also return different addresses based on the asker's rough location or the health of each target. Those are provider features layered on top of ordinary A and AAAA answers.
The reverse arrangement is common too: many names pointing to one address. A single server can host many sites on the same IP, and uses the hostname sent in the request to decide which one to show.
When both IPv4 and IPv6 exist
A device with both kinds of connectivity asks for both record types. It then has to pick. Modern browsers and many applications use an approach called Happy Eyeballs: start with a preferred address, usually IPv6, and if it does not connect quickly, try the other in parallel.
This hides many faults, but not all. Software without such fallback may wait through a long timeout when the IPv6 address is broken. Mail delivery, scripts and older devices are typical places to notice.
So the rule is to publish an AAAA record only when:
- the server has a stable global IPv6 address,
- the web or application server is listening on it,
- the firewall allows the ports over IPv6, and
- you monitor it as you monitor IPv4.
Certificate issuance can be affected too: an authority validating your domain may connect over IPv6 and fail if the AAAA record leads somewhere wrong.
What you cannot put in these records
- A port number. DNS address records have no field for it. Services on unusual ports need the port in the URL, or a mechanism such as SRV records where the software supports it.
- A URL or path.
https://example.com/shopis not an address. Redirects are done by a web server. - Another hostname. Use CNAME for that, where allowed.
- A private address on the public internet. Publishing
192.168.1.10in public DNS is legal but useless to outsiders, and some resolvers strip private answers as a safety measure.
Pointing a domain at a server
- Find the server's public address from your hosting provider or the server itself.
- Create an A record for the apex, and one for
www(or a CNAME fromwwwto the apex). - Add AAAA records if IPv6 is ready.
- Remove old or parking records at the same names, or visitors will be split between servers.
- Wait for the previous TTL to pass, then test.
If the address belongs to a home connection, it may change. See static vs. dynamic IP addresses. Dynamic DNS services update the record automatically, but they cannot help if your provider places you behind carrier-grade NAT.
Testing
On macOS or Linux:
dig www.example.com A +short
dig www.example.com AAAA +short
curl -4 -I https://www.example.com/
curl -6 -I https://www.example.com/ The two curl lines force IPv4 and IPv6 respectively, which is the clearest test that each path serves your site. The IPv6 test needs a network that has IPv6.
On Windows PowerShell:
Resolve-DnsName www.example.com -Type A
Resolve-DnsName www.example.com -Type AAAA Common faults
The site shows an old page for some people. Either their cache has not expired, or a leftover record points to the old server. Check the whole record set. DNS caching and TTL explains the timing.
It works on mobile data but not on office Wi-Fi, or the reverse. Mobile networks often use IPv6, so a broken AAAA record shows up there first.
The name resolves but nothing loads. DNS has done its job. Look at the firewall, the web server and the certificate.
An unexpected address appears. Check for a wildcard record, a hosts file entry or a second DNS provider still listed for the domain.
Wildcard address records
A record whose name is * answers for names that do not otherwise exist in the zone:
*.example.com. 300 IN A 192.0.2.10
mail.example.com. 300 IN A 192.0.2.25 With these two records, mail gets its own address, while anything.example.com receives 192.0.2.10. Wildcards are handy for services that give each customer a subdomain.
They have a few surprises. A wildcard stops applying to a name as soon as that name exists in the zone with any record type. If blog.example.com has only a TXT record, asking for its address returns nothing, and the wildcard does not fill in. A wildcard also makes every typo resolve, which can hide mistakes and lead visitors to a confusing error on your server instead of a clear "not found". Use one when you need it, not as a default.
Choosing a TTL for address records
Address records are the ones you are most likely to change in a hurry. A value between a few minutes and an hour suits most websites. Go shorter if you rely on DNS to steer around failures, and longer for machines that never move. Before a planned change, lower the value well in advance so that old copies expire quickly, then raise it once the new address has proved itself.
Remember that all records in one set should share a TTL. If you add a second A record with a different value, many systems will adjust one to match or behave unpredictably.
A checklist for a server move
Moving a site is the moment these records matter most. A calm sequence looks like this:
- Build the new server and test it by connecting to its address directly. With
curl, you can pretend DNS already points there:
curl --resolve www.example.com:443:198.51.100.25 https://www.example.com/ - Lower the TTL on the existing A and AAAA records.
- Wait out the old TTL.
- Update both record types in the same sitting. Changing only the A record leaves IPv6 visitors on the old machine, which is an easy thing to miss.
- Watch the logs on both servers until the old one goes quiet.
- Restore your normal TTL and, later, release the old address.
The wider job, including data and certificates, is covered in migrating a website to a new host.
Reverse lookups are separate
An A record goes from name to address. Going from address to name uses a PTR record, which is controlled by whoever holds the address block, usually your hosting or internet provider. Creating an A record does not create the PTR. Mail servers care about this a great deal, and PTR records and reverse DNS explains how to get it set.
Housekeeping
Address records go stale quietly. When you shut down a server or release a cloud address, delete the records that point to it. An address returned to a provider can be assigned to someone else, who would then receive visitors to your name. A periodic review of every record against the systems you still run is a small job that prevents that kind of surprise, which is covered in dangling DNS and subdomain takeover.