The best route is the longest match route to the destination IP address. The route lookup process matches the destination IP address with the route available in the routing table and chooses the longest match route as forwarding route. To match the destination IPv4 address of a packet with the routes in the routing table; the minimum number of far left bits must match between the IPv4 address of the packet and the route in the routing table. The router fined the best route in the routing table for the packet using the subnet mask. The data packet never contains the subnet mask in the packet header. The best route is the longest match or greatest number equivalent far left bits. The figure below illustrates the maximum bits match, which is the best route for the packet.
If the router receives a packet a packet destined for 172.16.2.100. The router has three possible routes for the packet: 172.16.0.0/16, 172.16.1.0/24 and 172.16.2.0/24. Look it the table above in the figure to understand the longest matches routing process.
172.16.2.0/24 has the longest match; so the router has selected this route as the best route and forwards the packet to Ethernet 1/1. For any of these routes to be considered a match there must be at least the number of matching bits indicated by the subnet mask of the route.