DNS A vs CNAME — Explained in 5 Minutes

A records point to an IP. CNAMEs point to another name. That single sentence solves 90% of indie DNS confusion — here is the other 10%.

Every host gives you DNS instructions in their own dialect: “Add an A record to 76.76.21.21” or “Point your CNAME to cname.vercel-dns.com”. If those sentences feel arbitrary, you have not learned the one-page model of DNS. This page is that model.

Background

DNS translates names (yoursite.com) to addresses (93.184.216.34) so browsers can connect. Records are the entries that perform the translation. A and CNAME are the two you will touch 99% of the time as an indie dev. The rest (AAAA, MX, TXT, NS) come up rarely.

How to tell

  • You added a domain in Vercel / Firebase / Netlify and it says “verification pending” or “invalid configuration”.
  • You typed in your domain after setup and got a “site cannot be reached” page.
  • You see your domain working at www.yoursite.com but not yoursite.com (or vice versa).
  • dig yoursite.com returns the wrong IP or no answer.

Quick verdict

A records point a name at an IP address. CNAMEs point a name at another name. Use A for the root domain (yoursite.com). Use CNAME for subdomains (www.yoursite.com, blog.yoursite.com). When the host gives you both, use whichever they ask for.

Step by step

  1. Identify what you want to point. Root (yoursite.com) or subdomain (www.yoursite.com, app.yoursite.com)?
  2. Read your host’s DNS instructions. They will give you one of: an IP address (use an A record), or another domain (use a CNAME).
  3. Log into your DNS provider — Cloudflare, your registrar’s DNS, Route 53, etc.
  4. For the root domain: add an A record with Name @ (or blank, depending on provider) and Value = the IP they gave you.
  5. For www: add a CNAME with Name www and Value = the host name they gave you (e.g. cname.vercel-dns.com).
  6. Save and wait. Most providers update DNS in 60 seconds; some take longer for cache reasons.
  7. Verify with dig yoursite.com (Mac/Linux) or nslookup yoursite.com (any OS). Confirm the answer matches what you set.
  8. Check the host’s dashboard — it should switch from “pending” to “active” once it sees the right record.

Common pitfalls

  • Trying to put a CNAME at the root domain — most providers do not allow it. Cloudflare and a few others fake it with “CNAME flattening”, but standard DNS does not.
  • Adding both an A record and a CNAME for the same name — DNS rejects this configuration.
  • Setting TTL to 1 day during the move — change to 5 minutes BEFORE the move so the new value propagates faster.
  • Pointing DNS at the host but forgetting to add the domain in the host’s dashboard — DNS goes one way, the host needs to claim it.
  • Leaving old records that point elsewhere — DNS resolvers may serve stale data. Delete cleanly.
  • Editing DNS at the registrar when nameservers are pointed at Cloudflare (or vice versa) — changes go to a server nobody queries.

Who this is for

Any indie dev wiring up a domain to a host for the first time, or debugging why a domain is not working.

When to skip this

Already-deep DNS users — this article is intentionally the 5-minute model, not a deep dive.

Worked example

What an A and CNAME record look like in your DNS provider’s editor:

Type   Name   Value                       TTL
A      @      76.76.21.21                 300
CNAME  www    cname.vercel-dns.com.       300

How to verify after saving:

# Check the A record on the root
dig yoursite.com +short
# Expected: 76.76.21.21

# Check the CNAME on www
dig www.yoursite.com +short
# Expected: cname.vercel-dns.com. then the resolved IP

# Force a non-cached lookup against a specific resolver
dig @1.1.1.1 yoursite.com +short

If dig returns the old value, your local resolver is still caching — wait or query a public resolver directly.

FAQ

  • Can I use a CNAME for the root domain?: Standard DNS says no. Cloudflare offers “CNAME flattening” that mimics it. Vercel and Netlify use ALIAS or ANAME records on supported providers. When in doubt, use A.
  • What is ALIAS or ANAME?: A non-standard record some DNS providers offer to allow CNAME-like behavior at the root. It resolves to an IP at lookup time. Cloudflare’s “CNAME flattening” is the same idea.
  • How long should TTL be?: 300 (5 minutes) during a migration, 3600 (1 hour) or higher once stable. Lower TTL means faster updates, slightly more DNS traffic.
  • Do I need an AAAA record?: AAAA is the IPv6 version of A. Add one if your host gives you an IPv6 address. Most cases you can ignore it.

Tags: #Indie dev #Domain #DNS #Getting started