A router is known as the connecting device in networking. It is used to select the shortest route for a packet to achieve its target. A router’s main purpose is to attach different networks simultaneously. Like the firewall, it also works on the network layer, but it also works on the physical layer and data link layer of the OSI(Open Systems Interconnection) model. Unlike a firewall, it doesn't include encryption before routing the networks. A router does not protect the network from the threats, but it includes the sharing provision to share an internet connection between the networks.
The firewall is the specified version of the router. All data packets in it are entering or dropping network passes through the firewall and after checking whether the firewall allows it or not. All traffic must undergo the firewall, and only authorized traffic must pass.
The firewall must be strong. It is a system located between two networks where it implements an access control policy between those networks. Like a router, it also works on the network layer of the OSI model. Unlike a router, a firewall uses encryption to encrypt the data before transmission. A firewall does not share the network, but it includes the protecting provision to protect the network from the threats.