To provide an image forming apparatus including: a discharge tray which
can moves between a first position capable of loading a discharged sheet
and a second position that is separated from the first position; and a
sheet loading amount detection sensor which has a sheet detection flag
abutting against the upper surface of the sheet loaded on the discharge
tray and capable of moving in accordance with a loading amount of the
sheet loaded on the discharge tray, and detects the sheet loading amount
by detecting a position of the sheet detection flag, wherein when the
discharge tray means is located at the second position, the sheet
detection flag is removed from a position capable of detecting the sheet
loading amount.