An automatic swing device for a work machine is capable of performing a sieve operation in the posture where a work device is always at a posture suitable for sieve operation. An automatic swing device includes a posture sensor that detects a posture of a work device, and a controller that outputs signals to operate at least a stick cylinder and a bucket cylinder of the work device. The controller has an automatic swing mode in which the work device is automatically swung while the posture detected by the posture sensor is maintained to be in the range of a predetermined posture.