The invention discloses a speed reducer, which comprises a power input gear shaft, a first-level planet gear transmission component, an eccentric shaft of which the axis is deflected to the axis of the power input gear shaft in parallel, a second-level planet gear transmission component, a power output gear shaft and a speed reducer shell. The speed reducer employs the planet gear transmission mechanism, so the structure is compact; the floating planet gear transmission mechanism can adaptively compensate manufacturing and assembling errors and abnormal abrasion, and has small transmission error and high precision. In the transmission process, the differential transmission way of the rare-tooth planet gear of the speed reducer increases the number of meshed teeth in a transmission process, ensures strong bearing capability, stable transmission, low transmission noise and high transmission efficiency, and solves the nonlinear coupling problem of the speed reducer under an extreme working condition. In the transmission process, cambered drum teeth of the speed reducer can filter fluctuations caused by processing and installation errors and the bad working condition, so the abrasion is lowered, the transmission is more stable, the noise is lower, and the service life is longer.