What are TXT, MX, CNAME, and A records?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

When you set up email for a domain, your DNS provider will ask you to create several types of records. They all live in the same place (your DNS zone), but they do very different jobs. Here's what each one actually does.

TXT (Text) records store plain text strings that other servers can read. For email, they're the workhorse. Your SPF record is a TXT record. Your DMARC policy is a TXT record. DKIM public keys are usually published as TXT records too. Domain verification codes (the ones your ESP gives you to prove you own a domain) are also TXT records.

MX (Mail Exchange) records tell the internet which mail servers should receive incoming email for your domain. If someone sends a message to captain@deepcurrent.io, the sending server looks up the MX records for deepcurrent.io to find out where to deliver it. MX records also carry a priority number, so you can have a primary server and a backup.

CNAME (Canonical Name) records create an alias from one hostname to another. In email, you'll most often see CNAMEs used for custom tracking domains (so your click-tracking links show your domain instead of your ESP's) and sometimes for DKIM when an ESP hosts the key for you and wants updates to happen automatically on their end.

A (Address) records map a hostname to an IPv4 address. They matter less day-to-day for email authentication, but they're relevant for webmail interfaces, mail server hostnames, and anything that needs a direct IP connection.

For email specifically, TXT and MX records are the ones you'll touch most. TXT records handle authentication (SPF, DKIM, DMARC). MX records handle receiving. CNAMEs come up when you configure tracking or let your ESP manage DKIM on your behalf. A records stay mostly in the background unless you're running your own mail server.

If you want to see how your current TXT records look (SPF, DMARC, DKIM), our free SPF checker and DKIM record lookup can pull them up in seconds. No account needed.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Get a DNS record checklist for your setup

I just read about TXT, MX, CNAME, and A records. I'm setting up email authentication for your domain and using your ESP or mail provider. Based on my setup, which DNS records do I need to create, what values should each one contain, and how do I verify they're working correctly once published?

Edit the yellow boxes, then send to the AI of your choice.