CNAME Record — Canonical Name Alias

Learn how DNS CNAME records create aliases from one domain to another. Understand restrictions, CDN integration, and the difference between CNAME and A records.

CNAMEAlias

Zone File Entry

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

Detailed Explanation

What Is a CNAME Record?

A CNAME record (Canonical Name record) creates an alias from one domain name to another. Instead of pointing to an IP address, it points to a different domain name, which is then resolved to find the final IP address.

BIND Zone File Syntax

; Point www to the root domain
www.example.com.      3600    IN    CNAME    example.com.

; Point a subdomain to an external service
blog.example.com.     3600    IN    CNAME    custom.ghost.io.

; CDN integration
static.example.com.   3600    IN    CNAME    d111111abcdef8.cloudfront.net.

The CNAME target must be a fully qualified domain name (FQDN), not an IP address.

How CNAME Resolution Works

When a resolver encounters a CNAME, it follows the chain:

  1. Client queries www.example.com
  2. DNS returns CNAME: www.example.com → example.com
  3. Resolver queries example.com
  4. DNS returns A record: example.com → 203.0.113.50
  5. Client connects to 203.0.113.50

This adds an extra DNS lookup, so there is a slight performance cost compared to a direct A record.

Critical Restrictions

CNAME records have strict rules defined in RFC 1034:

  • No CNAME at the zone apex: You cannot create a CNAME for example.com (the root domain) because it would conflict with the SOA and NS records that must exist at the apex. This is one of the most common DNS misconceptions.
  • No other records alongside CNAME: If a name has a CNAME record, it cannot have any other record types (A, MX, TXT, etc.) at the same name.
  • No CNAME chains should loop: While CNAME chains are valid (a → b → c), circular references will cause resolution failures.

CNAME vs A Record

Feature A Record CNAME
Points to IP address Domain name
At zone apex Yes No
Extra lookup No Yes
Easy to change target Requires IP update Target handles IP changes

Common Uses

  • Pointing www to the bare domain
  • Integrating third-party services (CDNs, email providers, SaaS platforms)
  • Creating memorable subdomains that redirect to external platforms
  • Domain verification for services like Google and Microsoft

ALIAS / ANAME Alternative

Some DNS providers offer proprietary ALIAS or ANAME records that behave like CNAMEs at the zone apex by resolving the target at query time and returning the IP address directly. These are not standardized but solve a real limitation.

Use Case

Use CNAME records to point subdomains to external services like CDNs, hosting platforms, or SaaS products, and to alias www to your root domain.

Try It — DNS Record Generator

Open full tool