DNS records explained: A, CNAME, MX and TXT
DNS records are small instructions stored against your domain that tell the internet where to send visitors and email. An A record points your name to a server address, a CNAME makes one name an alias of another, an MX record says which server receives your email, and a TXT record holds text such as ownership proofs. You edit them at whoever hosts your DNS, which is often your registrar or your hosting provider.
What a DNS record actually is
Buying a domain gives you a name. It does nothing until you tell the internet what that name should do. DNS is the system that holds those instructions, and each instruction is a record.
Think of your domain as a shop sign. One record says where the shop is. Another says where the post goes. A third holds a note that proves you own the sign. Each record has a type, a name, a value and a TTL.
Most small businesses only ever touch four types: A, CNAME, MX and TXT. If you have just [registered a .pk domain with us](/register-pk-domain/), you will meet these soon, usually when you connect a website or set up email.
A record: pointing your name to a server
An A record connects a name to an IP address, which is the numeric address of a server. When someone types yourshop.pk, their browser asks DNS for the A record and then goes to that address.
A made-up example: you pay for hosting and the host gives you an address like 203.0.113.10. You create an A record with the name @ (meaning the bare domain) and that address as the value. Your site now loads from that server.
If your host later moves you to a new server, you change this one record. Nothing else about your domain needs to change. Keep a note of the old value before you edit, so you can switch back if something breaks.
CNAME record: an alias to another name
A CNAME does not point to an address. It says this name is just another name for that one. The final address is looked up from the target.
A common use is www. You set www.yourshop.pk as a CNAME of yourshop.pk, so both open the same site. Many store and website builders also ask you to point a name such as shop.yourshop.pk to a hostname they give you. They can then change their servers without asking you to update anything.
Two habits help. Do not use a CNAME on a name that already has other records, such as MX or TXT. And many DNS panels do not allow a CNAME on the bare domain itself, so use an A record there.
MX record: where your email goes
MX stands for mail exchange. It tells the world which server accepts email for your domain. Without a correct MX record, mail sent to you@yourshop.pk has nowhere to go.
Each MX record has a priority number. Lower numbers are tried first, and extra records act as backups. Your email provider gives you the exact values. For example, Google Workspace currently asks for one record with the name blank or @, priority 1 and the destination smtp.google.com. Accounts started before 2023 may still use values beginning with aspmx, and Google says those can stay if mail works.
Remove old MX records when you switch provider, or mail may keep landing in the old inbox.
TXT record: proofs and email trust
A TXT record stores plain text against a name. DNS itself does not act on it. Other services read it.
Three everyday uses:
- Verification: tools such as Google Search Console give you a code to paste as a TXT record. If it appears on your domain, you control it.
- SPF: a TXT record listing which servers may send email as your domain.
- DKIM and DMARC: further TXT records that help receiving mailboxes judge whether your email is genuine.
- Add the exact text your provider gives you, with no extra spaces. You can have several TXT records on one name.
TTL and where to edit your records
TTL means time to live. It is a number of seconds that tells other servers how long they may remember a record before asking again. A low TTL means changes spread sooner. A high TTL means fewer lookups. For the Google Workspace MX record, Google suggests your registrar's default or entering 1, and says changes can take up to 72 hours to be recognised.
To edit records, log in where your nameservers point. That may be your registrar, your web host or a service such as Cloudflare. Editing in the wrong place does nothing, because that panel is not the one being asked.
Not sure whose DNS panel is live? Ask your host which nameservers your domain should use. If you still need a name, [search for one](/domains/) first.
Common questions
What is the difference between an A record and a CNAME?
An A record points a name straight to an IP address. A CNAME points a name to another name and lets that name decide the address. Use A for your bare domain and CNAME for aliases like www.
Can I have more than one MX record?
Yes. Each has a priority number, and mail servers try the lowest number first. Extra records work as backups, but only use the set your email provider gives you.
How long do DNS changes take to work?
It depends on the TTL and on how long other servers have kept the old answer. Google says its MX changes can take up to 72 hours to be recognised, though many show up sooner.
Do I need to change DNS records when I buy a .pk domain from you?
Not to own the name. You only need records once you connect a website, email or a verification. We register the domain in your own name, and you or your developer then add the records your host asks for.