The invention relates to an online detection system for adhesion of straws to packing boxes, which is disposed on a milk packaging line comprising a transmission chain. The detection system comprises guide rails arranged on two sides of the chain, an electric eye and a proximity switch are arranged on two opposite sides of the guide rails, the proximity switch is connected with a detection plate, an electromagnetic valve, an air pipe and an electric bag blowing nozzle are arranged on the same side of the proximity switch, the air pipe and the electric bag blowing nozzle are connected with the electromagnetic valve, and the electric eye, the proximity switch and the electromagnetic valve are controlled by the control unit. The electric eye is used for detecting milk bags, and when a straw on the packaging box is abnormal, the lower end of the straw cannot contact with the detection plate to lead the detection plate to deflect, the proximity switch connected with the detection plate is normally opened, the control unit controls the electromagnetic valve to get powder for starting pneumatic equipment, and the electric bag blowing nozzle blows down the milk bag. By means of the online detection system, the problem that manual detection and unqualified product selection are low in efficiency is solved, and production normality is guaranteed.