DNS A Record Explained — What It Is and How to Use It
Quick answer
An A record maps a DNS name to an IPv4 address. Use it for an IPv4 endpoint whose address you control; use an AAAA record for a working IPv6 endpoint. Choose a TTL that fits your change schedule, and query the authoritative server and a recursive resolver to verify the published and cached answers.
On this page
What you'll learn
- Understand what an A record is and how it translates domain names to IPv4 addresses
- Learn the correct syntax and format for creating A records
- Use dig commands to query and verify A records in production
- Avoid common A record mistakes and choose between A and CNAME records
The A record is the most widely used DNS record type on the internet. Short for "Address record," it performs a single, essential function: mapping a human-readable domain name to an IPv4 address. IPv4 connections commonly use A records; IPv6 connections use AAAA records.
This guide covers everything you need to know about A records, from basic syntax to advanced configurations like round-robin load balancing, with practical dig command examples you can run yourself.
What Is an A Record?
An A record is a type of DNS record that stores the IPv4 address associated with a domain name. When a user types example.com into their browser, the DNS resolution process begins. A recursive resolver queries the authoritative nameserver for the domain and receives back the A record, which contains the IPv4 address where the web server is running.
Here is a minimal A record in standard zone file format:
example.com. 3600 IN A 93.184.216.34Breaking this down:
| Field | Value | Meaning |
|---|---|---|
| Name | example.com. | The domain name being resolved |
| TTL | 3600 | Cache the result for 3600 seconds (1 hour) |
| Class | IN | Internet class (virtually always IN) |
| Type | A | This is an Address record |
| Content | 93.184.216.34 | The IPv4 address the name points to |
Tip: The trailing dot after the domain name indicates a fully qualified domain name (FQDN). DNScale adds this automatically, so you do not need to include it when creating records through the dashboard or API.
How DNS Resolution Uses A Records
Understanding how A records fit into the DNS resolution process helps you troubleshoot issues and configure records correctly.
- A user types
www.example.cominto their browser - The operating system checks its local DNS cache
- If no cached result exists, the query goes to the configured recursive resolver
- The resolver checks its own cache, then queries the root servers, the
.comTLD servers, and finally the authoritative nameserver forexample.com - The authoritative server returns the A record:
www.example.com. 3600 IN A 93.184.216.34 - The resolver caches the result for the TTL duration and returns it to the client
- The browser connects to
93.184.216.34over TCP
Each step in this chain relies on the A record being correctly configured. An incorrect IP address, an overly long TTL, or a missing record will cause the connection to fail.
A Record Syntax and Format
Basic A Record
The simplest configuration points your apex domain (also called the root or naked domain) to a server:
example.com. 3600 IN A 192.0.2.1Subdomain A Records
You can create A records for any subdomain. Each subdomain can point to a different IP address, allowing you to run different services on different servers:
www.example.com. 3600 IN A 192.0.2.1
api.example.com. 3600 IN A 192.0.2.10
mail.example.com. 3600 IN A 192.0.2.20
staging.example.com. 3600 IN A 192.0.2.30Wildcard A Records
A wildcard A record matches any subdomain that does not have its own explicit record:
*.example.com. 3600 IN A 192.0.2.1With this in place, anything.example.com resolves to 192.0.2.1 unless a more specific record exists. This is useful for platforms that dynamically generate subdomains, such as SaaS applications providing customer.yourapp.com URLs.
Note: Wildcard records do not match the apex domain itself. You still need a separate A record for
example.com.
Multiple A Records and Load Balancing
One of the most practical features of A records is that you can create multiple records with the same name but different IP addresses. Servers or resolvers may vary answer order, and clients choose an address. This round-robin pattern can spread traffic, but does not guarantee equal distribution:
example.com. 300 IN A 192.0.2.1
example.com. 300 IN A 192.0.2.2
example.com. 300 IN A 192.0.2.3When a resolver queries for example.com, the authoritative server returns all three addresses. Most resolvers randomize or rotate the order, spreading requests across your servers.
Tip: Use a shorter TTL (300 seconds) for round-robin configurations. This allows resolvers to refresh the record set more frequently, which is important if you need to remove a failed server quickly. For more on TTL strategy, see DNS TTL Best Practices.
This approach works well for basic load distribution, but it does not perform health checking. If one server goes down, DNS will continue returning its address until you remove the record. For production-grade load balancing, use health-checked endpoints or a load balancer. Anycast authoritative DNS improves DNS delivery; it does not automatically health-check the application servers named in your A records.
Querying A Records with dig
The dig command is the standard tool for querying and debugging DNS records. Here are the most useful commands for working with A records.
Basic A Record Query
dig A example.comExample output:
;; ANSWER SECTION:
example.com. 3600 IN A 93.184.216.34Query a Specific Nameserver
To verify that your authoritative nameserver is returning the correct record, query it directly:
dig A example.com @ns1.dnscale.euThis bypasses any resolver caching and shows you exactly what DNScale is serving.
Query with Short Output
For scripts or quick checks, use the +short flag:
dig +short A example.comOutput:
93.184.216.34Check Multiple A Records (Round-Robin)
When you have multiple A records, dig returns all of them:
dig A example.com +shortOutput:
192.0.2.1
192.0.2.2
192.0.2.3Trace the Full Resolution Path
To see every step of DNS resolution from root servers down to the authoritative answer:
dig A example.com +traceThis is invaluable for diagnosing DNS propagation issues after making changes.
Check TTL Countdown
Run the same query twice in quick succession to see the TTL counting down, confirming your record is being cached:
dig A example.com | grep -A1 "ANSWER SECTION"TTL Best Practices for A Records
Choosing the right TTL value for your A records depends on how frequently the IP address might change:
| Scenario | Recommended TTL | Rationale |
|---|---|---|
| Stable production server | 3600-86400 (1h-24h) | Maximizes caching, reduces query load |
| Active development / staging | 300-900 (5-15 min) | Allows quick IP changes during iteration |
| Pre-migration (lower before changing) | 60-300 (1-5 min) | Ensures fast propagation when you cut over |
| Round-robin load balancing | 300 (5 min) | Allows rapid removal of failed servers |
| Disaster recovery / failover | 60-120 (1-2 min) | Minimizes downtime during failover events |
Creating A Records in DNScale
Using the Dashboard
- Navigate to your zone in the DNScale dashboard
- Click Add Record
- Set the fields:
- Name: Enter the subdomain (e.g.,
www,api) or@for the apex domain - Type: Select
A - Content: Enter the IPv4 address (e.g.,
192.0.2.1) - TTL: Set the cache duration in seconds (default: 3600)
- Name: Enter the subdomain (e.g.,
- Click Create Record
Using the DNScale API
Create an A record via the REST API:
curl -X POST "https://api.dnscale.eu/v1/zones/{zone_id}/records" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "www",
"type": "A",
"content": "192.0.2.1",
"ttl": 3600
}'Verify the record was created:
dig A www.example.com @ns1.dnscale.euFor infrastructure-as-code workflows, you can also manage A records using the DNScale Terraform provider or DNSControl.
Common Mistakes
1. Using a Private IP Address
A records can contain private IPv4 addresses, but those addresses are reachable only inside the appropriate private network. DNS resolution can succeed while the connection fails. Public websites normally need publicly reachable endpoints; internal services may intentionally use private records.
2. Forgetting the AAAA Record
An A record only provides IPv4 connectivity. Users on IPv6-only networks (increasingly common on mobile) cannot reach your server unless you also add an AAAA record. Always configure both for a proper dual-stack setup.
3. Setting TTL Too High Before a Migration
If you set a TTL of 86400 (24 hours) and then change the IP, some users may not see the new address for up to a full day. Lower the TTL well in advance of any planned changes.
4. Conflicting with a CNAME Record
You cannot have both a CNAME and an A record at the same name. If www.example.com has a CNAME, you cannot also add an A record there. Choose one approach or use an ALIAS record for apex domains.
5. Missing Reverse DNS (PTR Record)
For mail servers, many receiving servers check that the IP address in your A record has a matching PTR record. Without reverse DNS, your emails may be marked as spam.
A Record vs CNAME: When to Use Each
One of the most common decisions in DNS configuration is whether to use an A record or a CNAME record. Here is a quick decision framework:
Use an A record when:
- You are configuring the apex/root domain (
example.com) - You know the IP address and it is relatively stable
- You need maximum performance (no extra DNS lookup)
- You need other records (MX, TXT) at the same name
Use a CNAME when:
- You are pointing a subdomain to a third-party service (CDN, SaaS, PaaS)
- The target IP may change and is managed by someone else
- You want a single point of configuration that follows the canonical name
For a detailed comparison, see CNAME vs A Record.
How DNScale Handles A Records
DNScale uses authoritative DNS servers deployed across a global anycast network. When you create an A record through the dashboard or API:
- The record is written to the primary database
- It is immediately available on the authoritative nameservers
- The record replicates to all edge nodes via real-time database replication
- Users worldwide receive the answer from a topologically preferred edge location
This architecture provides sub-second record updates with global availability. DNScale supports all standard A record features including multiple records per name, wildcard records, and per-record TTL values.
Conclusion
The A record is the workhorse of DNS. It is the record type you will use most often, whether you are pointing a single domain to a web server or building a globally distributed infrastructure with round-robin load balancing. Getting A records right means understanding TTL trade-offs, remembering to add companion AAAA records for IPv6 support, and knowing when a CNAME might be a better fit.
For further reading, explore these related guides:
- DNS Record Types -- Overview of all DNS record types
- What Is DNS? -- How the Domain Name System works
- DNS AAAA Record Explained -- The IPv6 companion to A records
- CNAME Records Explained -- When to alias instead of using an IP
- DNS TTL Best Practices -- Choosing the right cache duration
Frequently asked questions
- What is the difference between an A record and a CNAME?
- An A record maps a name directly to an IPv4 address. A CNAME maps a name to another name, requiring a second DNS lookup to resolve to an IP. Use A records at the apex domain and where you control the IP; use CNAMEs for subdomains pointing to third-party services whose IPs may change.
- Can I have multiple A records for the same name?
- Yes. Multiple A records return a set of addresses. Answer ordering and client selection can spread traffic, but DNS alone does not guarantee equal distribution or health-check each server. A shorter TTL helps a removed address age out of ordinary caches sooner.
- What TTL should I use for an A record?
- For stable production servers, 3600–86400 seconds (1–24 hours) maximises caching and reduces query load. Before a planned IP change, lower the TTL and wait at least one full previous-TTL interval after authoritative publication before cutover.
- Do I still need an A record if I have an AAAA record?
- Yes, unless your audience is IPv6-only. Clients can query both A and AAAA records and choose a reachable address. Configure both when your service supports both protocols; publish AAAA only after IPv6 connectivity works.
- Why does my A record return a private IP?
- DNS can return a private IPv4 address, but public internet clients cannot route to it. Private addresses are valid for internal services; a public website normally needs a publicly reachable endpoint. Check whether the answer is intentional split DNS before replacing it.
Inspect the DNS records for your domain
Check public DNS answers alongside the commands in this guide. Online checks do not measure your device’s local DNS path.
Open DNS lookup