What is a DNS CNAME Record? | Definition, Function & Example

A DNS CNAME Record (Canonical Name Record) is a type of DNS record used to create an alias from one domain name to another. Instead of pointing to an IP address, a CNAME record points one domain (like www.example.com) to another domain (like example.com).

Key Functions of a DNS CNAME Record:

  • Creates domain aliases: Lets you point multiple subdomains to a single domain.
  • Simplifies DNS management: Updates to the target domain automatically apply to the alias.
  • Supports CDN and third-party services: Used to point domains to external platforms like Shopify or GitHub Pages.

Example of a DNS CNAME Record:

www.example.com.   IN   CNAME   example.com.

Best Practices for DNS CNAME Records:

  • Use CNAME records only for subdomains, not the root domain (use A or ALIAS instead).
  • Ensure the target domain is stable and properly configured.
  • Avoid CNAME chains (CNAME pointing to another CNAME), which can slow down resolution.