This paper discusses the global minimization of rational functions with or without constraints. We studied the sum of squares (SOS) relaxations and their properties to solve this kind of problem. Some special features are studied. As an application, we show how to find the nearest common divisors of polynomials via global minimization of rational functions.