Provided are a hydraulic circuit and a work machine in which hydraulic fluid pushed out from a head side of a hydraulic cylinder can be effectively utilized to be accumulated in an accumulator and the operability during tamping is improved. Pressure oil from a head side of a boom cylinder (7c1) is accumulated in a first accumulator (46) with a pressure accumulating circuit (A) through a control valve (61) which changes a communication amount between the head side of boom cylinder (7c1) and the first accumulator (46) in accordance with an operation amount of a lever. The pressure oil from the control valve (61) to the first accumulator (46) is bypassed by a bleed-off valve (63) during tamping when boom cylinders (7c1), (7c2) repeatedly extend and contract in a predetermined period of time such that a work machine vertically moves.