Skip to main content
All CollectionsDNS Records
What is a CNAME Record and How to Create It?
What is a CNAME Record and How to Create It?

A comprehensive guide explaining CNAME records, their use cases, setup instructions, and best practices for DNS management and email security.

Updated over 2 months ago

What is a CNAME Record and How to Create It?

A CNAME (Canonical Name) record is a type of DNS record used to create an alias for a domain name, mapping it to another Fully Qualified Domain Name (FQDN). This simplifies DNS management and helps when multiple subdomains need to point to the same destination. CNAME records play a crucial role in web hosting, content delivery networks (CDNs), and email security by simplifying domain management and ensuring traffic is routed correctly.


What is a CNAME Record Used For?

A CNAME record is commonly used for:

  • Multiple Subdomains: Pointing multiple subdomains (e.g., www.example.com, blog.example.com) to a single root domain (example.com).

  • Content Delivery Networks (CDNs): Redirecting traffic to CDN endpoints for improved performance and faster content delivery.

  • Email Security Verification: Associating specific services like DMARC, SPF, or DKIM with a domain for validation and secure email delivery.

  • Service Integration: Redirecting traffic for third-party services like website builders or email marketing platforms to a custom domain.

  • Global Domain Management: Pointing domains registered in multiple countries back to a central domain (e.g., example.co.uk pointing to example.com).


How Does a CNAME Record Work?

When a browser queries a domain with a CNAME record, the following steps occur:

  1. Query Initiation: The browser queries the DNS resolver for the IP address of blog.example.com.

  2. CNAME Lookup: The resolver finds a CNAME record mapping blog.example.com to example.com.

  3. Further Resolution: The resolver then queries the IP address of example.com by checking its A record.

  4. Result Return: The browser finally receives the IP address and connects to the website., displaying the content hosted at example.com.


CNAME Record Format

A CNAME record follows this standard format:

blog.example.com  CNAME   example.com
  • Name: The subdomain being aliased (blog.example.com).

  • Record Type: CNAME specifies the record type.

  • Value: The target domain (example.com).


How to Create a CNAME Record

To createCreating a CNAME record in your DNS settingscan be done through most DNS hosting platforms. Follow these steps:

  1. Log in to Your DNS Provider: Access the control panel of your DNS service provider (e.g., GoDaddy, Cloudflare, Google Domains).

  2. Locate DNS Management Section: Find the section for managing DNS records.

  3. Create a New Record: Select 'Add Record' and choose 'CNAME' as the record type.

  4. Enter Record Details:

    • Host/Name: The subdomain (e.g., www or blog).

    • Target/Value: The domain you want it to point to (e.g., example.com).

    • TTL (Time to Live): Leave the default or set a custom TTL for propagation speed.

  5. Save the Record: Confirm and save the record to apply changes.

  6. Verify Propagation: Allow some time for DNS changes to propagate across global servers.


CNAME Record Example

blog.example.com   CNAME   example.com www.example.com    CNAME   example.com

If example.com's IP address changes, you only need to update its A record without modifying each subdomain’s CNAME record.


CNAME Record Restrictions and Limitations

While useful, CNAME records have some limitations to be aware of:

  • Cannot Point to an IP Address: A CNAME can only point to another domain, not a direct IP address.

  • Not for Root Domains: Root domains (example.com) must have an A record, not a CNAME.

  • No Mixing Record Types: If a CNAME is set on a hostname, other records like A or MX cannot coexist on the same hostname.

  • Chaining Issues: Avoid using multiple CNAME records in a chain, as it can slow down DNS resolution and create reliability issues.


CNAME vs. ALIAS Records

  • CNAME Record: Requires multiple lookups, as it redirects to another domain.

  • ALIAS Record: Works similarly but resolves the IP directly, often preferred for root domains where CNAME is restricted.


CNAME Record Use Cases in Email Security

CNAME records are often used in email security setups, including:

  • DMARC (Domain-based Message Authentication, Reporting & Conformance): A CNAME can point to a hosted DMARC service for policy enforcement and reporting.

  • SPF (Sender Policy Framework): Used for email sender validation to prevent spoofing.

  • DKIM (DomainKeys Identified Mail): Ensures email authenticity and integrity by verifying the sender's domain.


Troubleshooting CNAME Issues

  • Check Propagation Time: DNS changes may take time to propagate, usually within 24-48 hours.

  • Avoid CNAME Chains: Excessive CNAME chaining can slow resolution and lead to errors.

  • Ensure Proper Configuration: Verify that the CNAME points to an existing domain and avoid circular references.

  • DNS TTL Adjustments: Lowering the TTL can speed up DNS propagation times.


Conclusion

A CNAME record simplifies domain management by allowing multiple subdomains to point to a single domain name. It’s essential for web management, CDNs, and email security configurations. Mastering CNAME records can streamline website management, improve security, and ensure reliable domain resolution. To explore more about DNS records and email security, check out the YourDMARC Knowledge Base for tools and resources on domain compliance and protection against email fraud.

Did this answer your question?