Air compressor including a piston body, a rotating device and a main frame provided with a cylinder and a motor, the cylinder being fitted with the piston body, the motor being capable of driving the rotating device to have the piston body conduct reciprocating motion in the cylinder, the rotating device including a gear body that is assembled with a counterweight provided with a central axle corresponding to the center of the gear body and a crankpin placed at a distance from the central axle, so that the gear body and the counterweight rotates about the central axle, characterised in that the counterweight is horizontally divided into two integrally formed halves, including a left half and a right half, with a common line connected between the center of the central axle and the center of the crankpin, the left half having a weight different from the right half; the counterweight and the crankpin are made of metal, and the gear body is made of plastic and formed by a plastic molding process together with the counterweight and the crankpin; the gear body defines a central through hole, the counterweight is formed together with the gear body such that the central axle extends out of the central through hole of the gear body to be mounted to the axle hole of the main frame, so that the rotating device can rotate about the axle hole of the main frame; and the counterweight is vertically divided into two integrally formed portions including an upper portion and a lower portion, the lower portion having a dimension greater than the upper portion to form an extension beyond the upper portion, the counterweight being provided at the bottom of the lower portion with two integrally formed steps, including a first step and a second step, wherein the first step is formed on the bottom of the lower portion, the second step is formed on the first step, and the central axle is formed on the second step, the counterweight defining at the bottom of the lower portion a first recess next to the central axle and defining a first through hole at the bottom of the first recess, the first and second steps defining a curved recess facing towards the first recess; the gear body defining at its top an integral inner space including an upper inner space and a lower inner space, wherein the upper inner space corresponds to the upper portion of the counterweight, the lower inner space corresponds to the lower portion of the counterweight, and the central through hole is defined at the bottom of the lower inner space and corresponds to the first step of the counterweight, the gear body further defining at the bottom of the lower inner space a second through hole to be aligned with the first through hole of the counterweight for allowing the crankpin to be fitted into the first and second through holes; wherein the counterweight is assembled into and formed together with the gear body by mating the upper portion, the lower portion, and the first step of the counterweight respectively with the upper inner space, the lower inner space, and the central hole, whereby the second step and the central axle of the counterweight extend out of the central hole of the gear body to be mounted to the axle hole of the main frame.