The knowledge of vortex nucleation barriers is crucial for applications of superconductors, such as single-photon detectors and superconductor-based qubits. Contrarily to the problem of finding energy minima and critical fields, there are no controllable methods to explore the energy landscape, identify saddle points, and compute associated barriers. Similar problems exist in high-energy physics where the saddle-point configurations are called sphalerons. Here, we present a generalization of the string method to gauge field theories, which allows the calculation of energy barriers in superconductors. We solve the problem of vortex nucleation, assessing the effects of the nonlinearity of the model, complicated geometry, surface roughness, and pinning.