There are organizations that are called registries that manage each TLD option. When you register domain names, you would first visit a domain registrar who would in turn check with the registry that manages that TLD to see if the domain is available. If the domain for the TLD you want discovers that it is in fact available, the registry adds it to their registry and gives you access to it. If the domain has already been registered by another user for that TLD, you will be shown during the domain registration process that the domain isn't available.
Even when you register and pay for your domain name, you won't necessarily be able to use the name for several hours or even a few days. The domain must propagate, meaning that the official domain name registry must be updated with your website's Domain Name System information. That's something that occurs on the backend without any need of input from you.
Before you sign up for Web hosting and start building a website, you need to buy the domain name where visitors will find your site. Hundreds of different registrars sell domains, so first and foremost, know that domain names work the same no matter which registrar you use. You don't need to buy your domain from the same company that will host your site. Aside from picking a registrar -- and, of course, your site's name -- you also need to pick a top-level domain like .com or .org.
Now it’s time to see if your domain name choices are available. Once you’ve come up with a few strong domain candidates, it’s time to plug them into Namecheap’s domain name search bar. We will search available domain names for you and let you know if your first choice of second-level domain or TLD is available. We’ll also suggest some alternate TLDs you might try if your first domain choice isn’t available.