In a vehicular ad-hoc network (VANET), the vehicles are the nodes, and these nodes communicate with each other. On the road, vehicles are continuously in motion, and it causes a dynamic change in the network topology. It is more challenging when there is a higher node density. These conditions create many difficulties for network scalability and optimal route-finding in VANETs. Clustering protocols are being used frequently to solve such type of problems. In this paper, we proposed the grasshoppers’ optimization-based node clustering algorithm for VANETs (GOA) for optimal cluster head selection. The proposed algorithm reduced network overhead in unpredictable node density scenarios. To do so, different experiments were performed for comparative analysis of GOA with other state-of-the-art techniques like dragonfly algorithm, grey wolf optimizer (GWO), and ant colony optimization (ACO). Plentiful parameters, such as the number of clusters, network area, node density, and transmission range, were used in various experiments. The outcome of these results indicated that GOA outperformed existing methodologies. Lastly, the application of GOA in the flying ad-hoc network (FANET) domain was also proposed for next-generation networks.