Through the last years, several types of numerical and combinatorial optimization algorithms have been used as useful tools to minimize functional forms. Generally, when those forms are non-linear or occur in problems without a specific optimization method, stochastic methods based on search algorithms have shown good results due to its smaller susceptibility to be trapped in a local minimum. Besides that, they can easily be implemented to work with other techniques, in this class of algorithms, the genetic ones have received special attention because they are a robust optimization tool. An algorithm can be named genetic when it uses some kind of codification to transform a set of possible solutions of a given problem in a population that will evolve subject to operators inspired, or not, by mechanisms of natural selection. In other words, they work with a population of solutions to obtain better solutions in the next generation. To do this, they use only information of cost and prize. In this work, we propose a genetic algorithm optimization technique (GAOT) to fit diatomic potential energy curves. In order to show this method, we obtain the analytical functions of the H 2 + and Li 2 systems using ab initio energy calculations with Rydberg trial functions. The diatomic vibrational energy spectra is determined from these potentials and the results are compared with other methods. This study shows that the quality of the GAOT fitting is as good as the best optimization techniques recommended to fit diatomic systems. This technique is very important because it arises as a new option to fit potential energy curves for diatomic reactions.