Routers and switches are both pieces of networking equipment that help data move across the network to their final location, but they work differently, and actually function at different levels of the networking stack. What is the difference between a router and a switch?
The least intelligent kind of networking device is a hub, which takes data in one port, and then retransmits it out every other port. So any information sent or received by any single computer on a hub is retransmitted to every other computer. This is bad for security, obviously, but it also uses up a lot of bandwidth on the network, as computers have to receive data that they don’t need.
A switch uses a little more intelligence. It learns the IP address of each computer attached to it, by matching up IP addresses with hardware MAC addresses. When data comes into the switch, it only sends data back out the port assigned to that computer’s MAC address. Switches are said to work at a hardware level, and help relieve bandwidth across the network.
A router is the most intelligent networking device. But routers aren’t like really intelligent switches, they actually work in a completely different way. Routers are designed to connect networks together. So, your internal network might have IP addresses, like 184.108.40.206, while your Internet service provider might give your computer an IP address that starts with 64.x.x.x. A router can take internal traffic bound for destinations out on the Internet in general, and route it from your internal network to the external network. Whenever you change networks, you need a router. And vice versa when information comes from the external network to your home network.
So, just to restate, switches connect computers together within the same network, while routers connect entire networks together.