Routers and switches get mentioned together so often that beginners treat them as interchangeable boxes with blinking lights. They do fundamentally different jobs, and the cleanest way to separate them is by the question each one answers.
The switch: "which door in this building?"
A switch connects devices within one network — the PCs, printers, and access points of an office, all plugged into its ports. Its job is local delivery: when a frame of data arrives addressed to a particular device, the switch forwards it out of exactly the right port and no others. It learns, automatically, which device lives behind which port by watching traffic, and gets smarter within seconds of powering on. Think of it as the corridor system inside one building: it moves things between rooms brilliantly, but it has no concept of the outside world.
The router: "which building, which city?"
A router connects networks to each other — your office network to the internet, or one site to another. It operates on IP addresses and asks a bigger question: this packet isn't for anyone here, so which direction does it leave, and what's the next hop on the journey? Routers hold maps (routing tables) of where networks live and pass packets hop by hop toward destinations they'll never see directly. They're the border crossings and motorway junctions of networking.
A one-line test that always works: traffic staying inside the network is switching; traffic leaving the network is routing. Laptop to office printer — switch. Laptop to a website — switch to reach the router, router to leave.
"But my home router does everything"
Correct — and that's the source of the confusion. The home "router" is really four devices in one plastic shell: a router (the internet connection), a small switch (those LAN ports on the back), a wireless access point (the Wi-Fi radio), and usually a firewall and DHCP server too. Enterprises buy these as separate dedicated devices because each needs to be bigger, faster, and independently manageable — but the roles are identical. Understand the home box as a bundle and enterprise networking stops looking foreign; it's the same anatomy, unbundled.
Where this pays off immediately: fault isolation. Two devices in the same office failing to see each other is a switching-layer problem. Everyone reaching internal systems but nobody reaching the internet is a routing problem. Different question, different box, different fix.