An air compressor comprising: a tank configured to accommodate compressed air having a pressure; a compression mechanism configured to supply compressed air to the tank ; a motor configured to drive the compression mechanism ; a storing unit included in a control circuit , wherein the storing unit is configured to store information indicating a history of an operation state of the air compressor ; wherein the control circuit is configured to measure a pressure of air in the tank ; the control circuit is configured to select one of a plurality of modes, each of the plurality of modes having the rotational speed of the motor and the reference restart pressure, at least one of the rotational speed and the reference restart pressure being different from among the plurality of modes; the control circuit is configured to set a flag to execute one of the plurality of modes as a target mode in which the control circuit controls the motor to restart by comparing the reference restart pressure and rate of change of pressure corresponding to the target mode with the pressure of the compressed air and rotates the motor at the rotational speed corresponding to the target mode; and wherein the control circuit is configured to change the target mode from the one of the plurality of modes to another one of the plurality of modes depending on the question whether the flag has been set for the first time or a second time in a row, and the control circuit is configured to set the rotational speed to a first rotational speed when the information satisfies a prescribed criteria relating to a consumption amount of the compressed air, wherein the control circuit is configured to set the rotational speed to a second rotational speed slower than the first rotational speed when the information does not satisfy the prescribed criteria. a tank configured to accommodate compressed air having a pressure; a compression mechanism configured to supply compressed air to the tank ; a motor configured to drive the compression mechanism ; a storing unit included in a control circuit , wherein the storing unit is configured to store information indicating a history of an operation state of the air compressor ; wherein the control circuit is configured to measure a pressure of air in the tank ; the control circuit is configured to select one of a plurality of modes, each of the plurality of modes having the rotational speed of the motor and the reference restart pressure, at least one of the rotational speed and the reference restart pressure being different from among the plurality of modes; the control circuit is configured to set a flag to execute one of the plurality of modes as a target mode in which the control circuit controls the motor to restart by comparing the reference restart pressure and rate of change of pressure corresponding to the target mode with the pressure of the compressed air and rotates the motor at the rotational speed corresponding to the target mode; and wherein the control circuit is configured to change the target mode from the one of the plurality of modes to another one of the plurality of modes depending on the question whether the flag has been set for the first time or a second time in a row, and the control circuit is configured to set the rotational speed to a first rotational speed when the information satisfies a prescribed criteria relating to a consumption amount of the compressed air, wherein the control circuit is configured to set the rotational speed to a second rotational speed slower than the first rotational speed when the information does not satisfy the prescribed criteria. <EOS>