This application relates to the field of electronic technologies, and discloses a transformer and a power supply, to provide a magnetic cylinder distribution structure of a magnetic core while reducing a winding loss by using fractional turn, where the magnetic cylinder distribution structure of the magnetic core is conveniently to implement, thereby reducing product costs. The transformer includes a magnetic core, where the magnetic core includes a first magnetic cylinder and a second magnetic cylinder. One end of the first magnetic cylinder is coupled to one end of the second magnetic cylinder and the other end of the first magnetic cylinder is coupled to the other end of the second magnetic cylinder, to form an annulus.