A work machine comprising: an articulated work device including a boom and an arm; a plurality of hydraulic actuators (5, 6, 7) including a boom cylinder driving the boom, the plurality of hydraulic actuators (5, 6, 7) driving the work device; an operation device (45a, 45b, 46a) that gives an instruction on an operation of the work device in response to an operation by an operator; and a controller being configured to control, during the operation of the operation device, at least one of the plurality of hydraulic actuators (5, 6, 7) such that the work device is positioned on or above a predetermined target surface, the controller being configured to control a velocity of the boom cylinder on the basis of a boom lowering operation amount of the operation device, characterized in that the controller is configured to calculate, as a limiting velocity for the boom cylinder, a first velocity set to decrease according to a decrease in a distance between the target surface and the work device when the boom lowering operation amount of the operation device is smaller than a first operation amount, and is configured to calculate a second velocity as a limiting velocity for the boom cylinder when the boom lowering operation amount of the operation device is equal to or larger than the first operation amount, the second velocity is defined by a weighted average of the first velocity and a third velocity set to change according to one of the boom lowering operation amount of the operation device and the distance between the target surface and the work device, and is set such that an increase in the boom lowering operation amount reduces a weight for the first velocity while increasing a weight for the third velocity, and when the velocity of the boom cylinder based on the boom lowering operation amount of the operation device is higher than the limiting velocity, the velocity of the boom cylinder is limited to the limiting velocity. an articulated work device including a boom and an arm; a plurality of hydraulic actuators (5, 6, 7) including a boom cylinder driving the boom, the plurality of hydraulic actuators (5, 6, 7) driving the work device; an operation device (45a, 45b, 46a) that gives an instruction on an operation of the work device in response to an operation by an operator; and a controller being configured to control, during the operation of the operation device, at least one of the plurality of hydraulic actuators (5, 6, 7) such that the work device is positioned on or above a predetermined target surface, the controller being configured to control a velocity of the boom cylinder on the basis of a boom lowering operation amount of the operation device, characterized in that the controller is configured to calculate, as a limiting velocity for the boom cylinder, a first velocity set to decrease according to a decrease in a distance between the target surface and the work device when the boom lowering operation amount of the operation device is smaller than a first operation amount, and is configured to calculate a second velocity as a limiting velocity for the boom cylinder when the boom lowering operation amount of the operation device is equal to or larger than the first operation amount, the second velocity is defined by a weighted average of the first velocity and a third velocity set to change according to one of the boom lowering operation amount of the operation device and the distance between the target surface and the work device, and is set such that an increase in the boom lowering operation amount reduces a weight for the first velocity while increasing a weight for the third velocity, and when the velocity of the boom cylinder based on the boom lowering operation amount of the operation device is higher than the limiting velocity, the velocity of the boom cylinder is limited to the limiting velocity.