The stability of skyrmions in various environments is estimated by analyzing the multidimensional surface describing the energy of the system as a function of the directions of the magnetic moments in the system. The energy is given by a Heisenberg-like Hamiltonian including terms representing Dzyaloshinskii-Moriya interaction, anisotropy energy and interaction with an external magnetic field. Local minima on this surface correspond to the ferromagnetic and skyrmion states. Minimum energy paths (MEP) between the minima are calculated using the geodesic nudged elastic band method. The maximum energy along an MEP corresponds to a first order saddle point on the energy surface and gives an estimate of the activation energy for the magnetic transition, such as creation and annihilation of a skyrmion. The pre-exponential factor in the Arrhenius law for the rate, the so-called attempt frequency, is estimated within harmonic transition state theory where the eigenvalues of the Hessian at the saddle point and the local minima are used to characterize the shape of the energy surface. For some degrees of freedom, so-called “zero modes“, the energy of the system remains invariant. They need to be treated separately and give rise to temperature dependence of the attempt frequency. As an example application of this general theory, the lifetime of a skyrmion in a track of finite width for a PdFe overlayer on a Ir(1 1 1) substrate is calculated as a function of track width and external magnetic field. Also, the effect of non-magnetic impurities is studied. Various MEPs for annihilation inside a track, via the boundary of a track and at an impurity are presented. The attempt frequency as well as the activation energy has been calculated for each mechanism to estimate the transition rate as a function of temperature.