HeadlinesBriefing favicon HeadlinesBriefing.com

DNS Record Types: A, CNAME, MX, NS Explained

DEV Community •
×

When you type a website address, the Domain Name System acts as the internet's phonebook. It translates human-readable names into server locations using specific record types. Each record serves a distinct purpose, from mapping domains to IP addresses to routing email. Understanding these basics is crucial for anyone managing a website or application.

The primary A Record directly links a domain to an IP address, like example.com pointing to 192.168.1.1. A CNAME Record creates an alias, sending a subdomain like www.example.com to another domain. Crucially, you cannot use a CNAME on a root domain, only on subdomains. This distinction is fundamental for proper web hosting.

For email, MX Records direct messages to specific mail servers, with priority numbers determining the order of delivery attempts. NS Records, meanwhile, designate which name servers control all DNS settings for a domain. This is how you might point a domain bought from GoDaddy to manage its records through Cloudflare, a common developer workflow.