A router is a computer networking device that forwards data packets across an internetwork toward their destinations, through a process known as routing. Routing occurs at layer 3 (the Network layer) of the OSI seven-layer model.
In non-technical terms, a router acts as a junction between two networks to transfer data packets among them. A router is essentially different from a switch that connects devices to form a Local Area Network (LAN). One easy illustration for the different functions of routers and switches is to think of switches as neighborhood streets, and the router as the intersections with the street signs. Each house on the street has an address within a range on the block. In the same way, a switch connects various devices each with their own IP address(es) on a LAN. However, the switch knows nothing about IP addresses except its own management address. Routers connect networks together the way that onramps or major intersections connect streets to both highways and freeways, etc. The street signs at the intersection (routing table) show which way the packets need to flow.
So for example, a router at home connects the Internet Service Provider’s network (usually on an Internet address) together with the LAN in the home (typically using a range of private IP addresses) and a single broadcast domain. The switch connects devices together to form the LAN. Sometimes the switch and the router are combined together in one single package sold as a multiple port router.
In order to route packets, a router communicates with other routers using routing protocols and using this information creates and maintains a “routing table”. The routing table stores the best routes to certain network destinations, the “routing metrics” associated with those routes, and the path to the next hop router. See the routing article for a more detailed discussion of how this works.
Routing is most commonly associated with the Internet Protocol, although other less-popular routed protocols remain in use.
From Wikipedia Router article.