How does DNS actually work when I open a website?

When you type a domain, your system asks a DNS server for its IP address. If it doesn’t know, it checks other servers until it finds it. Then your browser uses that IP to load the website.