An image forming apparatus , comprising: an image carrier to bear a toner image; a facing member disposed opposite and facing the image carrier via a transfer position (N) at which the toner image is transferred onto a recording medium (P) from the image carrier ; a power supply to output a voltage between a first position on the image carrier side from the transfer position (N) and a second position on the facing member side from the transfer position (N); a resistance detector to detect electrical resistance between the first position and the second position via the transfer position (N); and a controller to selectively switch between a first transfer mode, in which the power supply outputs a direct current voltage, and a second transfer mode, in which the power supply outputs a superimposed voltage in which an alternating current voltage is superimposed on a direct current voltage, wherein, when the toner image on the image carrier is transferred onto the recording medium (P) at the transfer position (N), the controller selects either the first transfer mode or the second transfer mode, and when the resistance detector detects the electrical resistance between the first position and the second position via the transfer position (N), the controller selects the first transfer mode, wherein the power supply comprises: a direct-current voltage source to output the direct current voltage, when the first transfer mode is selected; and a superimposed voltage source to output the superimposed voltage in which the alternating current voltage is superimposed on the direct current voltage, when the second transfer mode is selected, characterized in that the resistance detector is provided in the direct-current voltage source . an image carrier to bear a toner image; a facing member disposed opposite and facing the image carrier via a transfer position (N) at which the toner image is transferred onto a recording medium (P) from the image carrier ; a power supply to output a voltage between a first position on the image carrier side from the transfer position (N) and a second position on the facing member side from the transfer position (N); a resistance detector to detect electrical resistance between the first position and the second position via the transfer position (N); and a controller to selectively switch between a first transfer mode, in which the power supply outputs a direct current voltage, and a second transfer mode, in which the power supply outputs a superimposed voltage in which an alternating current voltage is superimposed on a direct current voltage, wherein, when the toner image on the image carrier is transferred onto the recording medium (P) at the transfer position (N), the controller selects either the first transfer mode or the second transfer mode, and when the resistance detector detects the electrical resistance between the first position and the second position via the transfer position (N), the controller selects the first transfer mode, wherein the power supply comprises: a direct-current voltage source to output the direct current voltage, when the first transfer mode is selected; and a superimposed voltage source to output the superimposed voltage in which the alternating current voltage is superimposed on the direct current voltage, when the second transfer mode is selected, characterized in that the resistance detector is provided in the direct-current voltage source . a direct-current voltage source to output the direct current voltage, when the first transfer mode is selected; and a superimposed voltage source to output the superimposed voltage in which the alternating current voltage is superimposed on the direct current voltage, when the second transfer mode is selected, characterized in that the resistance detector is provided in the direct-current voltage source . <EOS>