Every website opens except one. That one-name-only fingerprint almost always means something local is answering for that name before DNS is even asked — and that something is the hosts file. This page shows you how to prove it and clean it without breaking anything else.
The hosts file is a small text file from the earliest days of networking, and Windows still obeys it completely. Before your PC asks any DNS server about a name, it checks this file. If the name is listed, the address in the file is used and DNS is never consulted. That design is useful for testing, but it also means one leftover line can hijack or kill exactly one website on your machine while the rest of the internet works perfectly — the classic setup for a mystery ERR_NAME_NOT_RESOLVED that survives every normal DNS fix. Entries get there from old ad-blocking tricks, bundled software, cracks, well-meaning YouTube tweaks from years ago, and occasionally malware. The good news: the file is tiny, reading it takes a minute, and cleaning it is reversible if you back it up first.
These two tools look identical in purpose and behave completely differently, and the difference is the whole diagnosis. ping resolves names the way your browser does: hosts file first, then DNS. nslookup ignores the hosts file entirely and asks the DNS server directly — it was built as a DNS debugging tool, not a connection tool.
So when nslookup happily returns an address for a name that ping and Chrome both reject, DNS has been proven healthy in one stroke. Something in the local resolution path — realistically the hosts file — is intercepting that one name. No server change, cache flush or router reboot can fix a file that is re-read on every single lookup.
The file lives at C:\Windows\System32\drivers\etc\hosts and has no extension — if you see a hosts.txt, that is a different, unused file someone created by accident. To read and later edit it:
# are comments and harmlessOn a normal home PC the active part of this file is nearly empty. Long lists of names pointed at 127.0.0.1 or 0.0.0.0 mean a blocking tool or tweak populated it once — and your one failing site is probably in that list.
Before editing a single character, copy the file to your desktop as a backup. If anything behaves oddly afterwards, restoring that copy returns you to exactly where you started. This ten-second habit is what makes the whole repair safe.
# at the start of the line to disable it while keeping it visiblehosts with no extension — if Notepad insists on saving hosts.txt, your edit changed nothing and the real file is untouchedipconfig /flushdns so no cached copy of the bad answer survivesDo not delete the familiar localhost lines. And if the file contained names you never added and do not recognise, treat that as information: something on this PC edits system files. A full antivirus scan is the honest follow-up, not an optional extra.
Honesty cuts both ways: not every entry is junk. Offices sometimes add lines for an internal server, developers add them to test a site before launch, and some old accounting or licence software genuinely depends on a name pinned to a local address. Delete another program's working entry and you trade one broken name for another.
The safe rule is narrow: touch only lines that name the site that is failing. If the failing name is your company's internal portal, stop — that entry may be the only thing making it reachable, and the real problem is the address it points to. That is a conversation for your IT person, armed with this page's ping-versus-nslookup proof, which will save them the first hour of guessing.
Watch the video for the live walkthrough — spotting the guilty entry, cleaning the file and proving the site opens again.
▶️ Watch Full VideoIt is at C:\Windows\System32\drivers\etc\hosts, with no file extension. You must open it from an administrator Notepad to edit it, and the Open dialog needs its filter set to All Files before the file becomes visible.
Run ping and nslookup on the failing name. Ping follows the normal path including the hosts file, while nslookup asks DNS directly and ignores the file. If nslookup returns an address but ping says the host cannot be found, the hosts file is intercepting that name — DNS itself is healthy.
Delete only the lines naming your failing site, and keep a backup copy of the original file first. A typical home PC needs almost nothing in this file, but office software, developer setups and some licence tools do use deliberate entries, and removing those breaks other things.