Yeah, it can get kind of confusing especially since some routers have switches built in. But the two things are actually different.
A router is used to connect everyone in your local network (your home or business) to a point outside the home. This point is usually your internet service provider.
A switch is used to connect everyone in your local network to each other.
What’s neat is that it works so well that you really don’t have to even worry about whether or not you’re talking to a buddy in the next room or to a web site on another continent. It happens quickly and efficiently, and here’s a simple way of thinking about it:
Every device in your home or office has an address. That address is in a fairly small range. Some devices are just out there shouting “I’m here” all day so they are easy to find. If you’re trying to communicate, your computer will listen first to see if it hears the other device. If it doesn’t, it goes looking around your local network if it thinks it’s there.
If you’re looking for something that is outside that small range of addresses in your home, your computer goes straight to your router. The router takes over and says, “hey internet, there’s a person on my network that needs something.” It then builds a route (that’s why they call it a router) so your computer can talk directly with a computer somewhere else. This happens literally 10,000 times a day or more and you don’t realize it.