Difference between A record and CNAME record

A Record

A record stands for Address Record. A record is used to map domain name to the IP address of the system which hosts the domain.

Whenever you browse a website, you enter the address which in turn checks the name server and finds A record (if its mapped). The request is directed to the server with mapped IP address.

E.g. In the name server domain foo.bar has A record which maps to 123.456.678.900 . If you type http://foo.bar in address bar, then the request will be redirected to the system with the above specified address to serve the request.

Note: Some domain management systems uses ‘@’ symbol to represent the domain itself.

CNAME Record

CNAME stands for canonical name. CNAME records are used as an alias to another name.

Common example is www which uses to identify URLs as website. Usually www points to the domain name which in turn points to a server address to serve the request.

E.g. In name server there is a CNAME record which points www to foo.bar domain. There is also A record which points foo.bar to IP address 123.456.678.900 . So when you type http://www.foo.bar , first it will go to CNAME record and then to A record and finally request will be served by the host 123.456.678.900 .

Difference between A record and CNAME record

As mentioned above the difference lies in the items both points to.

  • A Records points the domain to specific IP Address
  • CNAME record points the domain to another name instead of IP. It serves as an alias



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store