A transfer device comprising: an image carrier (31; 121) movable in a predetermined moving direction to carry a toner image; a first rotary body (36; 2) to contact an outer surface of the image carrier (31; 121); a second rotary body (33; 25) pressed against an inner surface of the image carrier (31; 121) to form a transfer nip between the outer surface of the image carrier (31; 121) and the first rotary body (36; 2); and a transfer bias supply (39; 81) operatively connected to the second rotary body (33; 25) to supply a transfer bias including a superimposed bias that includes a direct current component and an alternating current component superimposed on the direct current component to transfer the toner image from the image carrier (31; 121) onto a recording medium conveyed through the transfer nip, the transfer device further comprising: a controller operatively connected to the transfer bias supply (39; 81) to control the transfer bias supply (39; 81) to cause the transfer bias to increase, between the image carrier (31; 121) and the first rotary body (36; 2), an electric potential of the first rotary body (36; 2) toward an opposite polarity to a charge polarity of toner of the toner image to be higher than an electric potential of the image carrier (31; 121), and to change, on the basis of identified recording medium type, a returning peak value which is one of a peak value of positive polarity and a peak value of negative polarity of the transfer bias and which generates an electric field that causes the toner having moved to the recording medium from the image carrier (31; 121) to return to the image carrier (31; 121) from the recording medium in the transfer nip, characterized in that the transfer bias supply (39; 81) increases the returning peak value in accordance with an increase in surface roughness of the recording medium corresponding to the identified recording medium type. an image carrier (31; 121) movable in a predetermined moving direction to carry a toner image; a first rotary body (36; 2) to contact an outer surface of the image carrier (31; 121); a second rotary body (33; 25) pressed against an inner surface of the image carrier (31; 121) to form a transfer nip between the outer surface of the image carrier (31; 121) and the first rotary body (36; 2); and a transfer bias supply (39; 81) operatively connected to the second rotary body (33; 25) to supply a transfer bias including a superimposed bias that includes a direct current component and an alternating current component superimposed on the direct current component to transfer the toner image from the image carrier (31; 121) onto a recording medium conveyed through the transfer nip, the transfer device further comprising: a controller operatively connected to the transfer bias supply (39; 81) to control the transfer bias supply (39; 81) to cause the transfer bias to increase, between the image carrier (31; 121) and the first rotary body (36; 2), an electric potential of the first rotary body (36; 2) toward an opposite polarity to a charge polarity of toner of the toner image to be higher than an electric potential of the image carrier (31; 121), and to change, on the basis of identified recording medium type, a returning peak value which is one of a peak value of positive polarity and a peak value of negative polarity of the transfer bias and which generates an electric field that causes the toner having moved to the recording medium from the image carrier (31; 121) to return to the image carrier (31; 121) from the recording medium in the transfer nip, characterized in that the transfer bias supply (39; 81) increases the returning peak value in accordance with an increase in surface roughness of the recording medium corresponding to the identified recording medium type. a controller operatively connected to the transfer bias supply (39; 81) to control the transfer bias supply (39; 81) to cause the transfer bias to increase, between the image carrier (31; 121) and the first rotary body (36; 2), an electric potential of the first rotary body (36; 2) toward an opposite polarity to a charge polarity of toner of the toner image to be higher than an electric potential of the image carrier (31; 121), and to change, on the basis of identified recording medium type, a returning peak value which is one of a peak value of positive polarity and a peak value of negative polarity of the transfer bias and which generates an electric field that causes the toner having moved to the recording medium from the image carrier (31; 121) to return to the image carrier (31; 121) from the recording medium in the transfer nip, characterized in that the transfer bias supply (39; 81) increases the returning peak value in accordance with an increase in surface roughness of the recording medium corresponding to the identified recording medium type.