How does the browser know which website to load when you type in the address?
There might be a bit more to it than you might expect, so lets explore the world of domains, DNS and name servers and hopefully by the end of it you will have a better understanding of how it all works.
As always with the "Basics" series, I will be glancing over some details and simplifying some processes for the sake of, hopefully, keeping things simpler and easier to understand.
You can think of a domain as like a "person". When you type in the name of the domain in your browser, the browser will find the location of the domain and transfer you to their location.
So if domains are like people, but how does the browser actually know where they are?
This is where the DNS comes into play.
Domain Name System (DNS)
At the risk of sounding old, the DNS is like a "phonebook" for the domains. Like a phonebook, the DNS have all the addresses and information about any given domain within, and will tell you exactly where a domain website is located (in this case IP address).
For example, when you type in "markeliasen.com" into your browser, the browser does not just know where a domain website is at. So the browser will first need to check the "phonebook" (DNS) of the domain to find out where to send you.
But just as in the real world, there are more than just 1 phonebook so how does the browser know which one to use?
If the DNS is like a phonebook, the name servers is what tells you exactly which phonebook you can find the details in. This is how the browser will know, of all the thousands or more DNS'es which exists, which one specifically to look in to find the correct details for a given domain.
But that leaves a question. How does the browser know the name servers of any given domain?
Bonus: "Domain Name Registrar"
It's hard to talk about name servers without also talking about what a "domain name registrar" ("registrar") is.
A domain name registrar is a company that manages the reservation of Internet domain names - Wikipedia
For example, if you register a .com domain, the domain reservation is handled and managed by ICANN who is the governing entity for .com's (among others); likewise if you were to register a .co.uk domain, it would be handled by Nominet.
This is where a domain's name servers will be registered to a domain.
Every DNS knows which registrar to ask to get the name servers of a domain, based on the domains extension (.com, .co.uk etc).
I hope this helps your better understand what domains, DNS'es and name servers are and how they work. Knowing this is important, especially if you are a web developer.
If there is anything you believe I didn't clarify properly or you would like me to elaborate on, just let me know!