The invention discloses an air tightness detecting and code spraying device used for a dust collector. The device comprises a rack, and a main control box and a display screen are arranged on one sideof the rack; an air tightness detecting mechanism and a code spraying mechanism are arranged on the other side of the rack, and the air tightness mechanism comprises an air exhauster, an air pipe, asealed shell, a fixed stand column, a connecting rod, a wind shield, a ventilating hard pipe and a ventilating hose; the code spraying mechanism comprises an X-axis motor, a ball screw, two X-axis guide rails, a movable plate, a Y-axis slide rail, a sliding block, an air cylinder and a code spraying device body. The device integrates air tightness detecting and code spraying, can perform code spraying after air tightness detection, reduces loading frequency, and is high in working efficiency. The air tightness detecting mechanism of the device is simple in structure, easy to realize and low inmanufacturing cost; the code spraying mechanism can flexibly and accurately move to perform code spraying, and therefore the device is good in practicability, greatly improves production efficiency for enterprises, and is suitable for assembly line production of the enterprises.