The invention discloses an automatic spraying device for trees, particularly relates to a paint spraying device adopting a special technology and provided with a deformable rubber sliding rail, and belongs to the field of forestry products. The automatic spraying device for trees is composed of a sliding rail, a sliding block control device, a hydraulic pump, a climbing fixing device, a spraying work device and an annular installation fixing device. The sliding block control device is installed on the sliding rail, the sliding block control device is divided into an upper part and a lower part, the upper part and the lower part are connected through the hydraulic pump, the climbing fixing device is connected with the sliding block control device through a movable joint, the connecting position is fixed through a bolt or a pin, and similarly, the spraying work device is installed on the up-down climbing fixing device, and in the moving process, the climbing fixing device and the spraying work device ascend along with climbing movement of the sliding block control device. The automatic spraying device for trees has the beneficial effects that when irregular protrusions exist on the surface of bark, stability of a barking machine on trees can be ensured, the device can be stably fixed to trunks through the sliding rail, the sliding block control device, the hydraulic pump, the climbing fixing device, the spraying work device and the annular installation fixing device, and more time and labor are saved in the working process.