The Kustaanheimo–Stiefel (KS) transformation maps the non-linear and singular equations of motion of the three-dimensional Kepler problem to the linear and regular equations of a four-dimensional harmonic oscillator. It is used extensively in studies of the perturbed Kepler problem in celestial mechanics and atomic physics. In contrast to the conventional matrix-based approach, the formulation of the KS-transformation in the language of geometric Clifford algebra offers the advantages of a clearer geometrical interpretation and greater computational simplicity. It is demonstrated that the geometric algebra formalism can readily be used to derive a Lagrangian and Hamiltonian description of the KS dynamics in arbitrary static electromagnetic fields.