The invention provides an electric shaking bed with a massage function. The electric shaking bed comprises a base and a bed body mounted to the base in a hanging manner, wherein a swing drive unit is arranged in the bed body, the bed body is driven by the swing drive unit to swing, and a massage unit, a mode switching unit and a controller are further arranged on the base and the bed body; when the shaking function is needed, a brake block is separated from a brake base, meanwhile, an upper pressing switch is triggered to control a circuit of a massage motor to be disconnected, then a controller starts a swing motor, and the bed body swings; when the massage function is needed, the brake block is meshed with the brake base, meanwhile, a lower pressing switch is triggered to control a circuit of the swing motor to be disconnected, then the controller starts the massage motor, and a massage cushion is driven to move vertically for realizing the massage purpose. For the electric shaking bed, through the mode switching unit, the massage function and the shaking function are combined, and the mode switching can be easily realized.