Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Updated
4 min read
A
CS student and full-stack developer from Pakistan. Building with JavaScript, TypeScript, React, and Node.js. Currently in ChaiCode's Web Dev Cohort 2026.

What is DNS ?

DNS is exectly like a phone book .

When we entered in any DNS section of a Domain , then there we saw A Record, CAA Record, NS Record, TXT Record CNAME Record etc. We need to manually update these records as soon as we host our website on another ip addresses .

Why DNS records are needed ?

DNS Records helps browser to identify correctly that where the server is and what is the ip address of the server , Using DNS Records browser can easily get`s IP address and can show the website to the client .

What is a NS Record ?

NS Records tells that who is the owner of this specific domain and which nameserver like ( godaddy/namcheap/spaceship/hostinger etc ) is managing it`s dns, and through NS only we go to dns and add A Record and CNAME Record.

Like if we buy domain from Namecheap then domain and DNS provider both will be Namecheap only, and one NS record become ns1.namecheap.com, now when we type website, then browser request to root server and root server will give data of nameserver ( link: ns1.namecheap.com ip address: 208.109.188.100 etc ), now browser from this link or ip address inside it can access A Record or CNAME record easily.

What is A Record ?

Remember A Record always show ip address.

When we tell the browser to open google.com then it request from root server and get`s data from it and then from that data it goes to google`s server , and in DNS section it first search for A Record because the server`s IP is in A Record and if IP address is find out then it show us the website. This means the browser only need the A Record`s IP address.

Now we host our website on any hosting providing server (netlify, vercel, digital ocean) then our code stay always available on vercel/netlify`s machine which never turn off and vercel/netlify give us one ip address (like 77.66.1.1) and tell us that add this ip address in your domain`s A Record. but

If for some reason in future vercel/netlify need to change their server/machine (normally it is not possible but if this happen then), then vercel will inform everyone through email`s to update thier A Records which is very big issue for millions of users so in this situation CNAME helps.

What is CNAME Record ?

CNAME use when browser don`t get updated ip address from A Record , then as alternative browser check CNAME and from here it takes ip address and show website. CNAME is one link given from vercel side ( like website`s hosted link etc 9cbe0a1c625.vercel-dns-07.com ) and vercel tell us that add this link in your CNAME Record so that in case if ip address change , then browser can access updated ip address from this link and this link cannot change only its ip address can update. This way without manually informing users through emails, vercel can automatic change and browser easily can access updated ip address from CNAME Record.

What is AAAA Record ?

This is also the more complex version of A Record . The ip address which we give in A Record that is ipv4, and in AAAA Record we add with more details (2001:0db8:85a3:0000:0000:8a2e:0370:7334 etc) and this is also known as ipv6.

Example:

Old: House address "Block 5, House 123, Lahore"

New: House detailed address "Block 5, House 123, Street 45, Sector 6, Lahore, Punjab, Pakistan."

In both one same house is find out, just format is different.

What is MX Record ?

DNS is exactly like a Phone book .

Just like in phone book it is write: "Ali ka number: 03001234567"

Similarly in DNS it is write: "google.com ka address: 142.250.185.46"

If you make your business website

Website: www.mysite.com Email: contact@mysite.com

Now in DNS you will add something like this:

A Record: mysite.com → 192.168.1.1 (Website is here)

MX Record: mysite.com → mail.mysite.com (Email is here)

What is TXT Record ?

TXT Record is like a small note space in DNS where we can put any extra text.

Normal DNS server address stores the addresses (A, CNAME) and mail server (MX), but TXT record is different. In this we can add anything in text form.

How All DNS Records Work Together for One Website ?

Let’s say:

Real setup in DNS:

When you type mysite.com:

  1. Browser → Root server → NS → Namecheap DNS

  2. Namecheap DNS → A Record → Vercel IP

  3. Vercel server → Send website

  4. Email → MX → Google → Deliver email

All Records work together, like a team.
and this is how whole domain dns system works.”

More from this blog

A

Abdul Rahman

13 posts

Writing about web development as I learn — projects, mistakes, and things worth sharing. CS student. ChaiCode Web Dev Cohort 2026.