# Networking – Why does localhost not work in Windows 8.1, but 127.0.0.1 does

hosts-filelocalhostnetworking

I have a HTTP server running on port 9876.

I put http://127.0.0.1:9876/ into Chrome and the page loads instantly.

I put http://localhost:9876/ into Chrome and the page never loads.

I have never modified C:\Windows\System32\drivers\etc\hosts.

Every line in the hosts file is commented out.

The following lines exist in the file and may be relevant:

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost


As I said, I have not added these lines myself. I have not edited the hosts file.

Obviously I can uncomment the second line to make localhost work. But why is this necessary if the first line is correct? Did Microsoft write the first line? It looks like they're telling me that localhost will work without being defined.