The invention relates to a packaging machine capable of automatically bagging and sealing, which belongs to the technical field of package. The packaging machine disclosed by the invention comprises a machine table, a rack arranged at one end of the machine table, a motor control device arranged at one side of the machine table, and a feeding device, an ultraviolet light disinfection device, an optical fiber counting device, a pushing device and a bag shaping device which are arranged on the machine table in sequence, as well as a bag fetching device, a hot-pressing sealing device and a discharge device which are arranged on the rack. The ultraviolet light disinfection device can be used for disinfecting and sterilizing products, so that the package is more sanitary; the pushing device can push the products into multi-row packaging, so that the working efficiency is improved; the bag shaping device enables the package to be more attractive, so that the packaging effect is good. The operation is simple, an operator only needs to place the products at storage boxes, then the equipment can automatically run, and packaged products can be conveyed out of a discharge belt, so that line production and automatic discharge are realized, accordingly, the efficiency is greatly improved, and the labor is saved.