Every time someone visits your website, sends you an email, or connects to any service on your domain, DNS is involved. It translates human-readable domain names into the IP addresses and configuration data that computers need. Understanding DNS records is not optional for developers — misconfigured DNS breaks websites, kills email delivery, and creates security vulnerabilities.
A Record — maps a domain to an IPv4 address
The A record is the most fundamental DNS record. It points a domain name to an IPv4 address.
When a user types example.com in their browser, the DNS resolver returns this IP address and the browser connects to it. You can have multiple A records for the same name (round-robin load balancing).
AAAA Record — maps a domain to an IPv6 address
Identical to an A record but for IPv6. As the internet transitions away from IPv4, most modern stacks should include both A and AAAA records.
CNAME Record — canonical name alias
A CNAME record creates an alias from one domain name to another. The resolver follows the chain until it reaches an A record.
CNAME pitfall: You cannot use a CNAME on the apex domain (bare domain without www). Also, a CNAME record pointing to a cloud service that has been deleted creates a subdomain takeover vulnerability. Always clean up CNAMEs when decommissioning services.
MX Record — mail exchange
MX records tell the world which mail servers accept email for your domain. Without correct MX records, no one can email you.
The priority number determines which server is tried first. If mail1 is unavailable, sending servers fall back to mail2.
TXT Record — text data (SPF, DKIM, DMARC, verification)
TXT records hold arbitrary text. They are used for:
- SPF — defines authorized mail senders
- DKIM — publishes cryptographic public keys
- DMARC — defines email authentication policy
- Domain verification — Google, GitHub, and others ask you to add a TXT record to prove domain ownership
NS Record — name servers
NS records specify which DNS servers are authoritative for a domain. These are set at your domain registrar and tell the internet where to find all other records for your domain.
NS records have the longest TTL. Changes to NS records (switching DNS providers) can take 24–48 hours to propagate because resolvers cache them aggressively. Plan migrations accordingly.
PTR Record — reverse DNS lookup
PTR records do the opposite of A records: they map an IP address back to a domain name. This is called a reverse DNS lookup.
PTR records are set by your hosting provider (not your DNS registrar) because IP addresses are owned by ISPs. For mail servers specifically, a missing or mismatched PTR record causes many mail providers to classify your emails as spam.
SOA Record — Start of Authority
Every DNS zone has exactly one SOA record. It contains administrative information: the primary name server, the zone administrator's email, and timing parameters like how often secondary servers should refresh.
You rarely edit SOA records manually — your DNS provider manages them. But understanding the serial number matters: when you make zone changes, some providers require you to increment the serial number to trigger zone transfers to secondary servers.