The invention discloses an automatic hat box forming and nailing machine with good and efficient and stable performance. The automatic hat box forming and nailing machine comprises a rack, a transmission module, a feed module, a forming module, a nailing module and a discharge module, wherein the transmission module is fixedly installed in the middle of the rack and penetrates through the whole rack in a horizontal direction from left to right, the feed module, the forming module, the nailing module and the discharge module are arranged on the rack in sequence from left to right, the nailing module comprises a nailing internal mold mechanism and a nailing machine head mechanism, and the nailing internal mold mechanism is matched with the nailing machine head mechanism. The machine has theadvantages of the simple structure, scientificity, convenience, high pertinence and high degree of automation, and the full-automatic nailing problem of a hat box is preferably solved. According to the nailing machine, the manufacturing requirement of hat cartons (boxes) on a large scale is effectively solved, the labor cost is reduced, the processing safety is guaranteed, energy consumption is reduced, and the rejection rate of scraps of paper is reduced. In addition, the automatic hat box forming and nailing machine is conveniently matched with an automatic packing assembly line due to highefficiency, and the requirement of the occupation of land for stacking the cartons is effectively reduced.