What is an A Record?
An A record (Address record) is the most basic type of DNS record. It points a domain or subdomain to an IPv4 address. When you type "google.com" into your browser, an A record is what tells your computer that the website is located at 142.250.190.46.
Structure of an A Record
example.com. 3600 IN A 93.184.216.34
- Host: The domain name (e.g.,
example.comorwww). - TTL (Time to Live): How long (in seconds) the record should be cached by DNS resolvers.
- Class: Usually
IN(Internet). - Type:
A. - Value: The 32-bit IPv4 address.
Primary Use Case
The primary use of an A record is to point your root domain (e.g., mysite.com) to the IP address of your web server. It is also used for subdomains like api.mysite.com.
Multiple A Records
You can have multiple A records for the same hostname. This is often used for Round Robin DNS load balancing, where the DNS server returns a different IP address each time to spread traffic across multiple servers.
A vs. CNAME
A common point of confusion is when to use an A record versus a CNAME record.
- Use A Records when you have a static IP address.
- Use CNAME Records when you want to point a subdomain to another domain name (e.g., pointing
wwwto your root domain). - Important: You cannot have a CNAME at the root (apex) of a domain. You must use an A record (or an ALIAS record if your provider supports it) for your root domain.
Best Practice: TTL Management
If you are planning to move your website to a new server, lower your A record's TTL to 300 seconds (5 minutes) at least 24 hours before the move. This ensures that when you update the IP address, the change propagates quickly across the internet.