an image forming apparatus sets the optimum transfer bias based on density of some sets of toner patches formed on an image bearing member or an intermediate transfer member. The toner patches are categorized into at least two groups according to their width in the main scanning direction.