Abstract. The magnetospheric magnetic ®eld may be conveniently described by two scalar functions (a, b), known as the Euler potentials. They are not uniquely de®ned, and they may be dicult to derive for con®g-uration more complex than a simple dipole. We propose here a simple numerical method to compute one possible pair (a, b). In magnetospheric regions of closed ®eld lines, a can be chosen as a function of the tube volume of unit magnetic¯ux. The method can be applied to a wide class of magnetic ®elds which describe the magnetospheric domain of closed ®eld lines and the conjugated ionosphere. Here, it is used with the T87 Tsyganenko model. The results coincide with the dipolar potentials at close distances from the Earth. At larger distances, they display an increasing distortion with the radial distance (or the invariant latitude in the ionosphere) and the magnetic activity. In the magnetosphere, the contours of a and b are stretched towards the nightside. In the ionosphere, they also extend towards the nightside and present major distortions in a narrow ring at the polar cap boundary, which maps distant boundary layers in the magnetosphere.