We compute the elliptic genera of two-dimensional N = (2, 2) and N = (0, 2) gauge theories via supersymmetric localization, for rank-one gauge groups. The elliptic genus is expressed as a sum over residues of a meromorphic function whose argument is the holonomy of the gauge field along both the spatial and the temporal directions of the torus. We illustrate our formulas by a few examples including the quintic Calabi-Yau, N = (2, 2) SU(2) and O(2) gauge theories coupled to N fundamental chiral multiplets, and a geometric N = (0, 2) model.