The image forming apparatus includes a developing unit that contains developer and that is detachable; a detection member that includes a detected electrode and that moves around a rotation shaft in the developing unit, an electrostatic capacitance sensor electrode that is provided on an outer side of the developing unit, an electrostatic capacitance sensor that detects an electrostatic capacitance between the detected electrode and the electrostatic capacitance sensor electrode and that outputs data related to the detected electrostatic capacitance, and a CPU that determines an amount of the developer in the developing unit based on the data output from the electrostatic capacitance sensor.