Choosing the right DNS record becomes much easier when you start with the service you are connecting. This reference explains what A, AAAA, CNAME, TXT, MX, CAA, and SRV records do, how to enter them, which records can conflict, and how to verify a change safely.
Overview
DNS records publish instructions for a domain. A browser, mail server, certificate authority, or application reads those instructions to determine where a service is hosted and whether a requested action is authorized. The record type identifies the purpose; the name, value, and other fields provide the details.
Before editing a zone, identify the exact hostname and service requirement. The root domain, such as example.com, is not the same DNS name as www.example.com or mail.example.com. Many DNS dashboards display the root as @, while others expect the full domain or leave the name field blank. Follow the syntax used by your provider rather than copying the dashboard label into another provider.
| Record | Primary purpose | Typical value | Important rule |
|---|---|---|---|
| A | Maps a hostname to an IPv4 address | 192.0.2.10 | Use an IPv4 address only |
| AAAA | Maps a hostname to an IPv6 address | 2001:db8::10 | Use an IPv6 address only |
| CNAME | Aliases one hostname to another hostname | app.host.example | Usually cannot coexist with other data at the same name |
| TXT | Publishes text for verification and email policies | site-verification=token | Enter the exact string supplied by the service |
| MX | Directs email to receiving mail servers | 10 mail.example.net | Includes a priority and a mail-hostname target |
| CAA | States which certificate authorities may issue certificates | 0 issue "ca.example" | Only add it when you understand the certificate workflow |
| SRV | Publishes a service host, port, priority, and weight | 10 5 443 service.example | The name commonly includes a service and protocol prefix |
TTL, or time to live, tells recursive resolvers how long they may cache an answer. A shorter TTL can make planned changes easier to adjust, while a longer TTL can reduce repeated lookups. The effective time to see a change still depends on existing caches and the resolver being queried, so TTL is not a guarantee of immediate propagation.
Checklist by scenario
Connecting a website or application
- Ask the hosting platform whether it requires an A record, AAAA record, CNAME, or a combination.
- For a fixed IPv4 server, add an A record with the supplied address. Add an AAAA record only when the application is actually reachable over IPv6.
- For a hostname supplied by a platform, add a CNAME at the requested subdomain, such as
wwworapp, pointing to the exact target. - Check whether the platform gives separate instructions for the root domain. A root hostname often cannot use a conventional CNAME because DNS standards reserve that name for other zone data. Some providers offer provider-specific alias or flattening behavior; treat that as a provider feature, not a universal CNAME rule.
- Keep old records until the new destination has been tested, but remove obsolete or conflicting records after the migration plan is complete.
An A record points directly to an address; a CNAME points to another name that can later resolve to an address. Do not put a URL such as https://app.example.com in either record. DNS values are hostnames or addresses, not full web URLs.
Verifying a domain or adding a TXT record
- Copy the verification hostname and value exactly, including punctuation, underscores, hyphens, and capitalization where the service requires it.
- Enter the hostname in the format your DNS provider expects. If the provider automatically appends your domain, enter only the requested label; otherwise, use the full name.
- Use TXT for site ownership checks, application configuration, and other text-based instructions only when the service specifically requests it.
- Save the record and use a DNS lookup tool to query the exact name and record type before clicking the service’s verification button again.
TXT records are also used for SPF email authorization. Do not create multiple independent SPF policies at the same hostname. Email authentication has additional DKIM and DMARC considerations; use the SPF, DKIM, and DMARC setup checklist when configuring a complete email authentication setup.
Setting up email delivery
- Confirm the mail provider’s MX hostnames and priority values. Lower numerical priority generally indicates preference when several MX records are present.
- Create MX records at the domain that receives mail. For a subdomain mailbox, place them at that subdomain instead of automatically placing them at the root.
- Enter the destination as a hostname, not an IP address. An MX record should point to a mail host that can be resolved separately.
- Review existing MX records before adding new ones. Records for an old provider can continue receiving mail or create unpredictable delivery behavior.
- Configure SPF, DKIM, and DMARC according to the mail provider’s instructions, then test sending and receiving from more than one mailbox.
For a broader email authentication workflow, see SPF, DKIM, and DMARC Setup. DNS changes alone do not migrate mailboxes, historical messages, or provider-side routing settings.
Controlling certificate issuance with CAA
- Confirm which certificate authority your hosting or certificate automation process uses.
- Add a CAA record only if you can maintain the allowed-authority list as certificate workflows change.
- Use the exact tag and value supplied by the certificate workflow, such as an
issueauthorization. - Test certificate renewal before relying on the restriction in production.
CAA is an authorization control, not a certificate itself. An incorrectly restrictive record can prevent a legitimate certificate request from succeeding. If several CAA records apply through the DNS hierarchy, review the complete set rather than inspecting only the record at the visible hostname.
Publishing service discovery with SRV
SRV records are used when a client needs more than a hostname: it may also need a port, priority, and weight. The record name commonly follows the pattern _service._tcp.example.com or _service._udp.example.com. The value contains priority, weight, port, and target in the order required by the service. Do not substitute a web URL, and confirm whether the target must have a separate A or AAAA record.
What to double-check
- Authoritative provider: Make sure you are editing the DNS provider named by the domain’s authoritative nameservers. Changing records at a registrar or secondary dashboard has no effect if it is not authoritative.
- Hostname formatting: Check whether the interface appends the domain automatically. A value intended for
wwwcan accidentally becomewww.example.com.example.comin some workflows. - Record conflicts: A CNAME generally cannot share a name with A, AAAA, MX, TXT, or other records. At the root, existing NS and SOA data also make ordinary CNAME use unsuitable.
- IPv6 readiness: Publish an AAAA record only when the service, firewall, load balancer, and application all support IPv6. Some clients may prefer IPv6 when it is available.
- TTL and caches: Record the previous value and TTL before changing production DNS. Query several public resolvers or networks, but remember that different answers can persist while caches expire.
- Proxy and routing modes: Some managed DNS platforms offer proxy, traffic-routing, or alias modes. Verify whether the mode changes the response or affects certificate validation, mail, or non-HTTP services.
- Automation safety: If you manage DNS with an API or Terraform, keep the zone configuration under review, protect credentials, and plan changes before applying them. The Route 53 tutorial provides a useful example of a controlled DNS workflow.
To verify a change from the command line, query the intended name and type directly. For example, dig A example.com, dig CNAME www.example.com, or dig MX example.com can reveal whether the expected record is visible. Querying the wrong name or type can make a correct change appear missing.
Common mistakes
- Using a URL as a DNS value: Remove the protocol and path. Use a hostname or IP address as required by the record type.
- Duplicating verification records: Keep the exact TXT values required by active services, but remove abandoned tokens when you no longer need them.
- Replacing all MX records casually: Mail migrations require timing and provider-specific planning. A quick replacement can interrupt delivery or leave old systems active.
- Adding both CNAME and A records at one name: Choose the record model required by the service. Do not add both merely to cover different possibilities.
- Assuming DNS controls every service setting: DNS can direct traffic or publish a token, but hosting configuration, firewall rules, application bindings, TLS settings, and mailbox provisioning may still be required.
- Checking only one resolver: A local cache, corporate network, or public resolver may hold an older answer. Compare authoritative results with recursive results during troubleshooting.
- Deleting records without a rollback: Export or document the current zone, note the intended change, and retain the old values until the result is confirmed.
When to revisit
Revisit this checklist whenever you launch a subdomain, connect a new hosting platform, migrate email, renew or automate certificates, add IPv6, or move DNS providers. It is also worth reviewing before seasonal planning cycles and whenever deployment or security workflows change.
For ongoing DNS automation, maintain a small record inventory with the hostname, type, purpose, owner, target, TTL, and last review date. Compare that inventory with the authoritative zone and remove records that no longer have an owner or documented purpose. If a team uses infrastructure as code, make the inventory part of the change review rather than treating the DNS dashboard as the only source of truth.
Before your next change, follow this short runbook:
- Write down the service, hostname, required record type, exact value, and rollback value.
- Confirm the authoritative DNS provider and inspect existing records at the same name.
- Apply one logically grouped change, using a documented TTL and the provider’s required hostname format.
- Query the exact record directly, then test the website, mail flow, verification process, or certificate workflow that depends on it.
- Record the final state and schedule a review when the related platform or deployment process changes.