A vacuum cleaner includes a housing that carries a suction inlet, a dirt collection vessel, a main filter compartment and a suction generator. The main filter is received in the main filter compartment. An airflow pathway connects the suction inlet, the dirt collection vessel, the main filter compartment and the suction generator. A dirt detection sensor is provided in the airflow pathway between the dirt collection vessel and the main filter compartment.