DNS Basics for Beginners: How Domain Names Work
DNS turns a domain name into an address computers can reach. Learn what happens when you type a URL, who controls what, and what the main record types do.
DNS, the Domain Name System, is the internet's address book. People remember names such as example.com. Computers need numeric addresses. DNS translates one into the other, and it also tells the world where to deliver email for a domain. Almost every website or mail problem that is not obviously a server fault is related to DNS, so a basic understanding saves a lot of time.
What happens when you open a website
- You type
www.example.cominto a browser. - Your device asks a recursive resolver, usually run by your internet provider or a public DNS service, for the address.
- If the resolver does not already have the answer cached, it asks the root servers, which point to the servers for the top-level domain, such as
.com. - The top-level servers point to the domain's authoritative name servers.
- The authoritative servers hold the real records and return the answer.
- The resolver gives the address to your browser and remembers it for a time set by the record's TTL.
- The browser connects to that address.
This all takes milliseconds and happens constantly.
Who controls what
| Role | What it does |
|---|---|
| Registry | Operates a top-level domain such as .com |
| Registrar | Sells you the domain and records your name servers |
| DNS host | Runs the name servers that hold your records |
| Web or mail host | Runs the servers your records point to |
These roles can be the same company or four different ones. The key point: the name servers listed at your registrar decide where your records are managed. If you edit records in a panel that is not the authoritative one, nothing changes.
The main record types
- A maps a name to an IPv4 address.
- AAAA maps a name to an IPv6 address.
- CNAME makes one name an alias of another name.
- MX says which servers receive email for the domain, with priorities.
- TXT holds free text, used for SPF, DKIM, DMARC and ownership checks.
- NS lists the authoritative name servers for the domain.
- SOA holds administrative details about the zone.
- CAA says which certificate authorities may issue certificates for the domain.
Reading a record
www.example.com. 3600 IN A 203.0.113.20
From left to right: the name, the TTL in seconds, the class (almost always IN for internet), the record type and the value. The addresses used in examples like this belong to a range reserved for documentation.
A typical small business zone
| Name | Type | Points to |
|---|---|---|
| @ (the domain itself) | A | Web server address |
| www | CNAME | The domain itself |
| @ | MX | Mail server hostname |
| @ | TXT | SPF policy |
| selector._domainkey | TXT | DKIM public key |
| _dmarc | TXT | DMARC policy |
The symbol @ is shorthand for the domain itself, also called the apex or root.
Name servers versus records
There are two different ways to point a domain to a service. You can change the name servers, which hands control of the whole zone to a different DNS host. Or you can leave the name servers and edit individual records, such as the A record. The first is simpler when you move completely, and the second keeps flexibility when different services handle web, mail and other parts. Our article on nameservers versus A records covers the choice in detail.
Common beginner mistakes
- Editing DNS at the registrar when the name servers point to a hosting provider, or the other way round.
- Forgetting that a trailing dot may be required in some editors for fully qualified names.
- Deleting records you do not recognise. They may be for email or verification.
- Using a CNAME at the root of a domain, which conflicts with other records.
- Expecting changes to be visible instantly everywhere.
Tools to look at DNS
You can inspect any domain with free tools. On a command line, dig or nslookup show what a resolver returns. Online lookup services show records from several locations. Before changing anything, copy the current records somewhere safe, so you can restore them if needed.
Why DNS matters for hosting
When you move to a new host, change a mail provider or add a service such as a CDN, the work is almost always in DNS. Taking a few minutes to understand your zone prevents downtime.
IPv4 and IPv6 in one minute
Addresses come in two families. IPv4 addresses look like four numbers separated by dots. IPv6 addresses are longer, written in hexadecimal with colons, and exist because IPv4 addresses are running short. A site that supports both publishes an A record and an AAAA record, and visitors use whichever their network supports. If you publish an AAAA record, make sure the server really answers on that address, otherwise some visitors will see errors while others do not.
Keep a copy of your zone
Before every DNS change, export or screenshot the current records. Many panels allow exporting a zone file. It is the cheapest insurance you can have, and it helps support teams diagnose problems faster.
DNS and Zebra Hosting
With Zebra Hosting, DNS for your hosted domains can be managed in Plesk, and the team can guide you through the records needed when you move. Support is available in 17 languages. Read about our hosting plans, or look up record guides in the knowledge base.