An image forming apparatus includes an image carrier; a transfer body; a leading-end gripping member that grips a leading-end portion of the recording medium when the recording medium is transported and that releases the leading-end portion when the recording medium to which a final toner image starts being transferred is separated from the transfer body; and a controller that controls a peripheral velocity of the transfer body and a peripheral velocity of the image carrier to change a ratio between the peripheral velocity of the transfer body and the peripheral velocity of the image carrier from a first ratio for transferring a toner image that precedes the final toner image to the recording medium to a second ratio for transferring the final toner image to the recording medium by making the peripheral velocity of the transfer body higher than the peripheral velocity of the image carrier.