Аннотация:In this paper, it is shown that the theory of an electromagnetic field can be formed on the basis of Cartan mechanics, similar to the mechanics of Lagrange and Hamilton, and in a form convenient for use in quantum electrodynamics. The formulation is based on the vector potential (single form), which is convenient for describing the interaction of the electromagnetic field with fermions in quantum electrodynamics. Cartan mechanics make it possible to include (using auxiliary differentials) additional conditions, for example, the Lorentz calibration imposed on the electromagnetic field.