Domain, Hosting and DNS: How They Work Together — A Beginner's Guide
A website needs three things to work: a domain, hosting and DNS. Beginners often mix them up or assume they're the same thing. The easiest way to explain them is with a shop in a city:
- Domain — the sign and the address that's easy to remember.
- Hosting — the actual building where the goods are kept.
- DNS — the city map that shows which building has that sign.
Without any one of the three, customers won't reach you.
What a domain is
A domain is the website name you type in the address bar: example.com, shop.co.uk. Computers actually find each other by IP addresses like 203.0.113.10, but numbers are hard to remember, so domains were invented.
You can't buy a domain forever — you rent it from a registrar for a year or more and renew it. If you forget to renew, the site stops opening, and after a while someone else can take the domain.
The part after the last dot is the domain zone: .com, .net, .io, .shop. Zones differ in price and registration rules.
What hosting is
Hosting is a server in a data center that stores the site's files and database and serves pages to visitors 24/7. Every server has its own IP address.
The main types:
- Shared hosting — space on a server alongside hundreds of other sites. Cheap and simple, but resources are shared.
- VPS — a virtual server with guaranteed resources and full access. You can install any software on it.
- Dedicated server — an entire physical server just for you, for large projects.
What DNS is
DNS (Domain Name System) is the system that turns a domain name into a server's IP address. It's essentially the internet's phone book: you know the name, DNS gives you the number.
DNS is what "connects" a domain to hosting. Until DNS has a record pointing to your server's IP, the domain and the hosting know nothing about each other — even if you bought both from the same company.
What happens when you type a website address
- You type example.com in the browser.
- The browser asks DNS: "What's the IP of example.com?"
- DNS answers: "203.0.113.10."
- The browser connects to the server at that IP.
- The server sends back the page, and the site opens.
All of this takes a fraction of a second. The DNS answer is also remembered (cached), so on repeat visits steps 2–3 are skipped.
The main DNS records
A domain's settings are stored as records. A beginner only needs to know six:
- A — links the domain to the server's IPv4 address. The key record: without it the site won't open.
- AAAA — the same for an IPv6 address.
- CNAME — makes one domain an alias of another. For example, www.example.com points to the same place as example.com.
- MX — says which server receives email for the domain.
- TXT — text records for proving domain ownership (for example, for Google Search Console) and protecting email from spoofing (SPF, DKIM, DMARC).
- NS — shows whose DNS servers manage the domain: the registrar, the hosting provider or Cloudflare. That's where all other records must be edited.
How to connect a domain to a server
There are two ways:
1. Add an A record. The domain stays on the registrar's DNS; you just enter your server's IP in its panel. You usually need two records: one for the domain itself (@) and one for www. The simplest and fastest option.
2. Change the NS servers. You hand DNS management over to your host or Cloudflare, and from then on all records are edited there. Handy if you want attack protection, a CDN or everything managed in one place.
Changes don't take effect instantly. A new A record usually works within minutes to hours (depending on TTL, the caching time), while an NS change can take up to 24–48 hours. During that time some users see the new site and others still see the old one — that's normal.
Common beginner mistakes
- Forgetting to renew the domain. The site disappears even though hosting is paid. Turn on auto-renewal and keep the email on your registrar account working.
- Registering the domain in a contractor's name. If a freelancer registered the domain to themselves, legally it's theirs. Always register it to yourself or your company.
- Editing records in the wrong place. If the NS point to Cloudflare, changes in the registrar's panel do nothing. First check whose NS the domain uses.
- Forgetting www. The site opens at example.com but not at www.example.com. You need a separate record for www.
- Breaking email during a move. When you change NS, old MX records don't move over by themselves. Copy all records before switching.
- Panicking right after a change. If the site doesn't open after 5 minutes, you usually just need to wait for DNS to update.
FAQ
Can I have a website without a domain?
Technically yes: the site will open by the server's IP address. But it's inconvenient for people, indexes poorly and getting an SSL certificate for a bare IP is much more hassle.
Do I have to buy the domain and hosting in the same place?
No. You can keep the domain with one registrar and the site on another host's server — DNS connects them. Keeping them separate is even safer: if you move to another server, the domain stays with you.
Can several domains point to one server?
Yes. One VPS can run dozens of sites with different domains: they all share one IP, and the web server works out which site to show.
What is a subdomain?
An address like blog.example.com or shop.example.com. You don't need to buy it separately — just add a DNS record, and it can even point to a different server.