A transformer and switching regulator that prevents winding's breakdown caused by the leakage magnetic field. A transformer has a core having an air gap, and a winding wound around the core. The turn density of the winding is made least on the air gap. The switching regulator has such a transformer.