Modeling of the topside ionosphere requires a knowledge of the electron and ion temperatures (Te and Ti) as a function of height. Data in the International Reference Ionosphere (IRI) model are sometimes conflicting, and extend only up to 3000 km. An exact, analytic solution is found for the variation of Te along a magnetic field line, making full allowance for changes in the cross section and inclination of the tube of force. The downward heat flux is assumed to decrease smoothly with height, becoming zero at the top of the field line. Changes in the Coulomb cross section increase plasmaspheric temperatures by 6–8%. For a given field line, the temperature profile is defined by two parameters, taken as the temperature To and gradient Go at a reference height of 400 km. Results are fitted to satellite data, for mean day and night conditions, at intervals of 5° in latitude and heights from 400 to 8000 km. Diurnal changes are reproduced using sunrise and sunset transitions that are matched to observed values. Seasonal changes in Te are generally less than experimental errors. A solar activity variation of 30–40% is required, at low heights, to match the change in neutral temperature. Exospheric temperatures must also increase by 10–20%, near solar maximum. A first-order correction is derived for high-latitude heating during periods of magnetic activity. Values of Ti are calculated from the Te profile and the neutral temperature Tn, giving results that agree well with mean observations. The use of physically acceptable temperature profiles, fitted to the often conflicting satellite data, should give more consistent results for most purposes.