Magnetic skyrmions are whirl-like nano-objects with topological protection. When driven by direct currents, skyrmions move but experience a transverse deflection. This so-called skyrmion Hall effect is often regarded a drawback for memory applications. Herein, we show that this unique effect can also be favorable for spintronic applications: We show that in a racetrack with a broken inversion symmetry, the skyrmion Hall effect allows to translate an alternating current into a directed motion along the track, like in a ratchet. We analyze several modes of the ratchet mechanism and show that it is unique for topological magnetic whirls. We elaborate on the fundamental differences compared to the motion of topologically trivial magnetic objects, as well as classical particles driven by periodic forces. Depending on the exact racetrack geometry, the ratchet mechanism can be soft or strict. In the latter case, the skyrmion propagates close to the efficiency maximum.