Learning objectives
After reading this article you will be able to:
- Tell domain, hosting, registrar and DNS apart
- Follow what happens between typing an address and seeing the site
- Decide where to buy each piece and what to change without taking the site down
If you are building your first site, you will often hear "get a domain and hosting" as if it were one product. They are two different things, usually sold by different companies, and knowing that keeps you from paying twice for something you already have or ending up with a name that points nowhere.
The classic analogy works: the domain is the shop's street address; hosting is the building where the shop operates. You can have an address with no building (the name exists, nothing answers) or a building with no friendly address (the site works, but only through a technical address).
What is a domain?#
A domain is a readable name that identifies a server on the internet, such as mysite.com. Computers find each other by IP addresses (203.0.113.10), which are hard to remember and can change. The domain is the stable nickname.
The name reads right to left: com is the top-level domain and mysite is the name you picked. All of it is just a name and an entry in a registry. There is no server or website inside it.
You also do not buy a domain forever. According to MDN, you pay for the right to use the name for one or more years and can renew that right. Your renewal has priority over other people's applications; without it, the name eventually becomes available to others.
What is hosting?#
Hosting is the always-on computer (server) that holds the files and the program behind your site, API or bot, with CPU, RAM, disk and a network connection. When someone visits the site, this server answers.
It comes in several forms: shared hosting, VPS, container platforms. What changes is how much you control and how much you must configure. For the full picture, see what is web hosting.
A server always has an IP address, and many hosts also give you a technical address (a subdomain of theirs). It already works for reaching the site; it just isn't pretty.
What connects a domain to hosting?#
DNS, the system that answers "which IP belongs to this name?" The domain alone does not know where your site lives: in the DNS panel you add a record saying "mysite.com points to this destination". RFC 1034 defines this model of names and records.
A visit goes like this:
- Someone types
mysite.com. - The browser asks DNS and gets the IP (or a target name) of your host.
- The browser connects to that server and requests the page.
- The host replies with the content.
You can see step 2 in a terminal:
dig mysite.com A +shortThe answer is the server IP (something like 203.0.113.10, a documentation example address). If the command returns nothing, the name does not point to any server (or is not registered at all). The details are in what is DNS and DNS records.
Where do you buy each one?#
A domain is sold by a registrar. For generic domains such as .com, ICANN describes an accredited registrar as the entity that offers registration to registrants, with direct access to the top-level domain registry. Country-code domains follow the rules of their own registry. When you register, you become the registrant and must keep your contact data correct.
Hosting is sold by hosting providers. Many registrars also sell hosting, and many hosts also sell domains, but they are separate contracts. Prices and what makes renewals expensive are in how much a domain costs.
How do domain and hosting compare?#
| Domain | Hosting | |
|---|---|---|
| What it is | Registered name (mysite.com) |
Server where the site runs |
| What it is for | An address that is easy to remember | Storing files and running the app |
| Who sells it | Registrar | Hosting provider |
| Billing | Per period (usually yearly) | Usually monthly or yearly |
| Where you configure it | Registrar and DNS panel | Host's panel |
| Without it | The site still works by IP or technical address | The name leads nowhere |
| Can you change one without losing the other? | Yes, by updating DNS | Yes, by updating the DNS target |
There is no best combination for everyone. Buying everything in one place cuts initial work. Buying separately keeps the domain under your control, independent of any host.
Do you need both?#
It depends on what you publish.
- A site or store customers will type in: yes. It needs hosting to exist and a domain to be found.
- An API used only by other programs: hosting is enough, and the technical address works. A domain helps keep the URL stable if you change servers.
- A Discord, Telegram or WhatsApp bot: hosting only. The bot connects out to external services and nobody types its address. A domain matters if you add a web dashboard or a webhook with its own URL.
- Professional email (
contact@mysite.com): the domain is required; the site's hosting is not, because email uses its own DNS records (MX).
What changes when you switch hosts?#
Only the DNS target. The domain stays registered where it was. The safe routine is to deploy on the new host, test through its technical address, lower the record TTL, change the record and check with dig. The step-by-step is in how to point a domain to your hosting.
The most expensive mistake is letting the domain expire while assuming the host covers it. If the registration lapses, the site goes down even with a perfect server. Turn on auto-renewal and keep the registrant email up to date.
How to do this on Square Cloud#
In the split between domain and hosting, Square Cloud sits on the hosting side. It does not register domains or host DNS zones: the domain stays registered in your name, with the registrar you choose.
Every web application gets a *.squareweb.app subdomain with HTTPS on all plans, so you can publish and test without a domain. Custom domains are available from the Standard plan; Hobby does not include them.
In the dashboard you add your domain and see the DNS records you must create at your registrar, with real-time validation status. TLS is issued automatically, and both accented domains (Punycode) and cache purge are supported. See the details in domains on Square Cloud.
Network
Custom domains, automatic TLS and a global CDN for your app
FAQs
Do I have to buy a domain and hosting from the same company?
No. They are independent services and it is common to buy them from different companies. Buying together simplifies the start; keeping them apart makes it easier to change hosting without touching the domain registration.
Can I have a website without a domain?
Yes. Many web hosts give your app a technical address of its own, and you can also reach a server by its IP. A domain makes the address memorable and professional, but the site works without one.
If I change hosting, do I lose my domain?
No. The domain stays registered with your registrar. To migrate, you deploy the site on the new host and change the DNS record to point the name at the new destination.
Who owns a domain name?
In practice you do not buy the name forever: you pay for the right to use it for a period and can renew it. While the registration is up to date, that right is yours.
More in Networking and domains
See all 27 articles- What is a load balancer and how does it work?A load balancer spreads incoming requests across several servers. Learn how it works, the main algorithms, layer 4 vs 7, and a working nginx example.
- DNS records explained: A, CNAME, MX, TXTDNS records are the instructions in a zone that tell the internet where a name points. Learn A, AAAA, CNAME, MX, TXT, NS and CAA with examples and dig commands.
- How to point a domain to your server or appTo point a domain to your server or app, create a CNAME (or A) record in your registrar's DNS panel. Steps, how to test it, and common mistakes.
- Cache-Control headers explainedCache-Control is the HTTP header that sets how long browsers and CDNs keep a response. Learn max-age, no-cache, immutable and ready-made recipes for each file type.