MacBook Pro won’t connect to the Internet I have been using my MacBook Pro for about 5 years with zero problems (running OS X El Capitan 10.11.6). 

I was using my iPhone XR as a Wi-Fi hotspot (as I’ve done millions of times before) two days ago and when I was done, I shut down my machine while it was still connected to the Wi-Fi hotspot from my iPhone (this is the only thing that I can think of that was out of the ordinary, as I always disconnect/turn off the hotspot off before shutting down). 

Yesterday, I tried to connect to a neighbour’s Wi-Fi router (which I’ve connected to a million times before as it usually remembers the password), but it wouldn’t connect and it kept telling me the password was incorrect even though I was looking right at the router and typing the same password I always do. Eventually I gave up and decided my neighbour’s Wi-Fi was the problem. 

Today I’ve turned on my laptop and it connected to the Wi-Fi in my apartment fine at first (as per usual) but then I realised that my browser wasn’t allowing me to access websites other than Google/Gmail, Facebook and YouTube. I was trying to log onto my utilities company website (as I’ve done a hundred times before) and it kept returning an error saying  the website could not be reached (even though it exists because I can access it on my phone using my apartment Wi-Fi which clearly works fine). I cleared my cache and deleted all known Wi-Fi networks and restarted my machine. 

Now I can’t connect to my own Wi-Fi network (that I’ve never had a problem with in the two years I’ve had it) - it won’t recognise my password. I tried connecting to my iPhone’s Wi-Fi hotspot (as I did 2 days ago as normal) and it won’t recognise that password which I’m looking right at on my phone. 

I have no clue what’s going on or how to fix it? My laptop is rejecting all Wi-Fi connections ever since that day I shut it down while still connected to my hotspot (I did nothing else differently since it was last working fine).

Does this sound like something anyone else has figured out in the past?? I’m a super basic Mac user, the built in diagnostics keep telling me I’m not connected to the Internet (i.e., useless), and I have no idea where to even start looking for solutions other than hoping to click my needle in a haystack solution out of the millions of hits on Google.
There can be many reasons for this and I am not aware of any single silver-bullet.  You'll need to try several things to chip away at the issue until you resolve it.

You can boot a mac into safe-mode to test (how you get there depends on the version of macOS).  

See:  https://support.apple.com/en-us/HT201262

You can also create a new (temporary) user account, then log into that account to see if it has the same issues as your primary account.  If it does not have the same issues, then it usually indicates that something in your account may be causing the problem.  This could be a corrupt .plist file.  It could be something that starts up at login (System Preferences -> User &amp; Groups -> (select your user) -> Login Items.  It could also be something that launches via launchctl (check the contents of ~/Library/LaunchDaemons).

You may need to do a bit of network sleuthing ... do you get an IP address (and what is it).  Home routers will generally issue an IP address in one of the RFC-1918 blocks (see: https://tools.ietf.org/html/rfc1918).  These typically begin with 192.168.x.x or 10.x.x.x but could include 172.16.x.x through 172.31.x.x (although I have never seen a home router use that 172 range).   

If the address begins with 169.254.x.x then this is a self-assigned IP (meaning the DHCP server did not issue an address.)

From here (assuming you have a valid IP address) you would want to check the value of /etc/resolv.conf (which lists the DNS servers your mac will try to use to resolve servers) and also check your default router using the command (in Terminal) netstat -rf inet (look for the row that begins "default").  (netstat -rf inet will only look for IPv4 addresses.  IPv6 is excluded.)

Make sure you can ping the IP address of the default router.