Choosing the correct DNS record is easier when you separate the service you are connecting from the hostname it controls. This reference explains A, AAAA, CNAME, TXT, MX, NS, SRV, and CAA records, then turns the differences into reusable checklists for hosting, verification, email, subdomains, and DNS automation.
Overview
DNS records publish instructions for a domain. A record can point a hostname to an IPv4 address, a CNAME can point it to another hostname, and an MX record identifies where email should be delivered. Other records support verification, delegation, service discovery, and certificate-issuance controls.
Before editing DNS, write down three details:
- Hostname: the name you are changing, such as
@,www,api, or_acme-challenge. - Record type: the kind of instruction supplied by your hosting, email, or SaaS provider.
- Value: the destination or verification string, copied exactly as provided.
Provider dashboards use different labels. The root or apex domain may appear as @, a blank name, or the full domain name. A trailing dot may appear in fully qualified hostnames, while some interfaces add it automatically. Confirm the provider's expected format before saving.
| Record | Primary purpose | Typical value |
|---|---|---|
| A | Maps a hostname to an IPv4 address | 203.0.113.10 |
| AAAA | Maps a hostname to an IPv6 address | An IPv6 address |
| CNAME | Aliases one hostname to another hostname | app.example-host.com |
| TXT | Stores text for verification or policy data | A provider-issued token |
| MX | Routes email for a domain | Priority plus a mail hostname |
| NS | Delegates DNS authority | Nameserver hostname |
| SRV | Publishes a service, port, and priority | Priority, weight, port, target |
| CAA | Controls which certificate authorities may issue certificates | Flag, tag, and authority value |
TTL, or time to live, controls how long resolvers may cache a response. A shorter TTL can make planned changes easier to adjust, while a longer TTL can reduce repeated lookups. Follow your provider's instructions and avoid changing TTL repeatedly while troubleshooting; caches may continue to show an earlier value.
Checklist by scenario
Connecting a website or server
- Use an A record when the service gives you an IPv4 address.
- Use an AAAA record only when you have a confirmed IPv6 address that the service accepts and serves.
- Use a CNAME when the service gives you a hostname, such as a platform endpoint.
- Check whether the provider supports the apex domain. A CNAME at the root is restricted by traditional DNS behavior, although some DNS providers offer an implementation-specific alias or flattening feature.
- Configure the root and
wwwhostnames separately unless your hosting provider explicitly handles both.
For example, a typical subdomain connection might be api.example.com as the name and a provider hostname as the CNAME value. Do not paste https://, a URL path, or a port into a normal CNAME value unless the provider specifically asks for a different format.
Verifying a domain or service
- Select TXT when the service instructs you to publish a text token.
- Enter the hostname exactly as shown. Verification names often begin with an underscore or include a service-specific prefix.
- Preserve capitalization, punctuation, hyphens, and quotation content in the value. Many DNS interfaces add quotation marks automatically, so avoid doubling them.
- Save the record, then use a DNS lookup tool or command-line query to check the authoritative result.
- Return to the service's verification screen only after confirming that the queried name returns the expected token.
To add a TXT record safely, first search for existing TXT records at the same hostname. Multiple TXT values can be valid, but replacing an existing value may break another verification or email policy.
Setting up email
- Use MX records supplied by your email provider to identify mail servers.
- Enter the priority number exactly. When multiple MX records exist, the lower preference value is generally attempted first.
- Use the mail server hostname, not an IP address, as the MX target.
- Review existing MX records before adding new ones. Old and new providers should not be mixed unless the migration plan requires it.
- Publish SPF, DKIM, and DMARC records according to the provider's instructions. Use the SPF, DKIM, and DMARC setup guide for a separate email-authentication checklist.
Delegating DNS or publishing a specialized service
Use NS records when delegating a zone or subdomain to another DNS service. Changing nameservers at the registrar is a separate action from adding ordinary records inside a zone. Confirm which system is authoritative before editing.
Use SRV records when a service documents a structured name containing a service and protocol, commonly with prefixes such as _service._tcp. Record the priority, weight, port, and target in the correct fields; putting all four pieces into one value field may produce an invalid record.
Use CAA records when you need to state which certificate authorities may issue certificates for a domain. If you use automated certificate renewal, coordinate CAA changes with your ACME process; the ACME certificate renewal guide covers the related DNS challenge workflow.
What to double-check
- Authoritative provider: Verify the domain's active nameservers. Editing records in the wrong dashboard will not change the live zone.
- Hostname format: Check whether the interface expects only the label, such as
app, or the complete name, such asapp.example.com. Some interfaces append the domain automatically. - Conflicting records: A hostname generally should not have a CNAME alongside A, AAAA, MX, or other data records. Remove conflicts only after confirming they are obsolete.
- Root-domain behavior: A record, AAAA record, or provider-specific alias may be needed at the apex when a plain CNAME is not supported.
- IPv6 readiness: Do not add an AAAA record simply because an IPv6 address exists. It must route to the same intended service and be correctly configured.
- Verification scope: A TXT record at
example.comis different from one at_service.example.com. Match the exact name. - Deletion impact: Before removing a record, search documentation, infrastructure code, certificate automation, and application configuration for references to its hostname.
For repeatable operations, keep DNS changes in a reviewable runbook or infrastructure-as-code workflow. Record the reason, owner, expected value, TTL, and rollback plan. The DNS runbook provides a useful audit structure for Cloudflare, Route 53, and other providers.
Common mistakes
- Entering a URL instead of a hostname: A record values are IP addresses, and CNAME values are hostnames. Neither normally accepts a complete URL with a protocol and path.
- Duplicating the domain name: If a dashboard appends
example.com, enteringwww.example.commay createwww.example.com.example.com. - Deleting every TXT record: TXT data may support several unrelated services. Add or remove only the specific value that has been identified.
- Leaving old MX records in place: Mail delivery can be inconsistent when records for different providers remain during an unplanned transition.
- Assuming propagation is the only problem: A wrong hostname, wrong zone, conflicting record, or application-side configuration can look like slow propagation. Query several resolvers and compare the answers.
- Testing only from one network: Local caches, corporate resolvers, and browser behavior can hide the current authoritative answer. Use direct DNS queries when investigating.
- Changing nameservers casually: Nameserver changes can affect every record in the zone. Export or document the current zone and plan the cutover before making the change.
When to revisit
Return to this checklist whenever you connect a new hosting platform, add a subdomain, migrate email, verify a SaaS product, renew certificates through DNS, or change DNS providers. Revisit it before seasonal planning cycles and whenever deployment or infrastructure workflows change.
As a practical closing routine, save the provider's requested record in a change ticket, compare it with the existing zone, apply the smallest possible edit, and verify the result from an authoritative lookup. Then test the actual service: load the hostname, send and receive a controlled email, complete the domain verification, or run the certificate challenge. If the result is unexpected, pause further edits and compare the authoritative response with the record shown in your DNS dashboard. This habit makes DNS automation safer and turns future changes into a repeatable deployment task rather than guesswork.