The invention discloses an automatic sorting machine for books in libraries. The automatic sorting machine comprises a bookshelf, a control system, a scanner, motors, a sensor, a conveying mechanism, a lifting mechanism, a moving mechanism and a guide rail. The books are arranged on a conveyor belt below the scanner, position information on the books can be scanned by the scanner, the first motor can be started under the control of the control system, a third wheel and a fourth wheel can be driven by the first motor, accordingly, the moving mechanism reaches specified positions, the first motor is stopped, the second motor is instantly started by the control system and drives the lifting mechanism to ascend and descend, book arranging heights of the specified positions can be detected by the sensor, the second motor is stopped under the control of the control system, the third motor is instantly started under the control of the control system and drives a first conveyor belt guide wheel, and the conveyor belt can be driven to place the books into the specified positions. The automatic sorting machine for the books in the libraries has the advantages that the automatic sorting machine is high in practicality, operation efficiency and response speed and good in flexibility, and can be widely applied to the libraries.