DNS Records from A to Z: A, CNAME, TXT, MX and NS
DNS is the internet's phone book: it translates names into server IP addresses. Learn the exact records a website needs in order to work.
What you will learn
- A record: connects the apex domain (@) to an IPv4 address (e.g. 76.76.21.21 for Vercel).
- CNAME record: an alias that points a subdomain (e.g. www) to a target host (cname.vercel-dns.com).
- TXT record: a text record used to verify ownership (Google, Meta) and protect your email reputation (SPF, DKIM).
- MX record: sets the mail server that receives email for your domain (e.g. Titan, Google Workspace).
- Nameservers (NS): decide which provider manages your domain's entire DNS zone.
Apex domain vs the www subdomain
The apex domain is the bare name without a prefix (e.g. firma.com). A subdomain is something like www.firma.com or app.firma.com.
- The apex (@) is connected with an A record: Name: @ | Value: 76.76.21.21 (Vercel IP)
- The www subdomain is connected with a CNAME: Name: www | Value: cname.vercel-dns.com
- In your Vercel settings, always set up an automatic 301 redirect from one to the other for SEO.
Email DNS records (MX, SPF, DKIM)
If you set up a client's website and don't take care of the MX records, their email inbox can stop working.
- MX (Mail Exchange): priority 10, server e.g. mx1.titan.email or aspmx.l.google.com.
- TXT for SPF:
v=spf1 include:_spf.google.com ~allhelps stop others from sending email in your name. - DKIM: a cryptographic signature that shows the email wasn't altered in transit.
Step by step
Check a domain's A record from the terminal
dig A zee.design +shortReturns the IP address the domain currently sends traffic to.
Check MX records for business email
dig MX zee.design +shortShows the active mail servers.
Tip from practice
Lower the TTL (Time to Live) to 300 seconds (5 minutes) a day or so before you switch servers. Once the old TTL has expired, your change will spread within minutes instead of taking up to a day.