In this paper genetic algorithm (GA) was used for the optimization of two natural gas network, the study focuses on fuel consumption minimization of the second gas network. Studies using GA to simultaneously optimize a gas network and a compressor station based on the constraint of the gas network and compressor station are limited. The relationship between several compressor speed and the total fuel consumption and the relationship between the sum of pressure drop in compressor station loops and compressor inlet flow are assessed for optimization. For this purpose, the optimization of two networks was presented and the results were compared with result from analytical methods. The first network problem was to determine the flow rates and node pressures under a given load, which serves as a guide in using GA. Comparison with result from analytical solution showed good agreement of predicted values. The second network consisted of two compressor stations, each containing six compressors with the objective to optimize the fuel consumption of the system. The simulation was divided into two main simulations, the first simulation was the flow optimization, which results in the optimum flow, based on the fitness function, which is the summation of pressure loss for each compressor station. In the second simulation which was the speed optimization, the optimum set of compressor speed was obtained which depends on the fitness function, which is the minimum fuel consumption, the flow obtained from the flow optimization served as input and remained constant. All speeds were simulated together. The predicted results were compared with literature and showed GA can be used for compressor station fuel optimization but still requires improvement. Based on the outcomes, data on natural gas network operations should be accessible to encourage studies on fuel consumption and CO2 emissions minimization.