A CNAME (canonical name) record makes one hostname an alias for another. When a resolver looks up the alias, DNS tells it the canonical target to ask about instead, and the resolver follows that target until it reaches an address record.
Chains
Targets can themselves be CNAMEs, forming a chain: www → app.example.net → eu.cdn.net → 203.0.113.10. Each arrow is one hop. A healthy chain ends at an A or AAAA record and never points back at itself.
The apex restriction
You cannot place a CNAME at the apex (root) of a domain, because the apex must also hold SOA and NS records and a CNAME is not allowed to coexist with other records for the same name. This is why example.com itself cannot be a CNAME while www.example.com can.
Flattening, ANAME and ALIAS
To point an apex at a provider that only gives you a hostname, DNS providers offer CNAME flattening (or ANAME/ALIAS records). The provider resolves the target for you and answers at the apex with the target’s current addresses, giving the effect of an apex CNAME without breaking the standard.