The invention relates to a self-locking compact sliding mechanism which comprises a permanent connecting baseplate, an air cylinder installing transition plate, an air cylinder mounting plate, an air cylinder, an in-place stop dog I, a connecting block, a linear guide assembly, a front end connecting block of an air cylinder rod, a fastening bolt, a locking nut, an in-place stop II and a protection box, wherein the upper part of an air cylinder body is connected and arranged on the front end surface of the permanent connecting baseplate by virtue of the air cylinder installing transition plate and the air cylinder mounting plate; the sliding block in the linear guide assembly is positioned on the permanent connecting baseplate, and is slidably matched with a linear guide; the protection box is arranged on the outer side of the straight line slide guide; the front end of an air cylinder expansion link and a connecting block on the front end of the cylinder rod are fixed by the locking nut, and the connecting block on the front end of the air cylinder is connected with the protection box by the fastening bolt; the in-place stop dog I is connected to the protection box by the connecting block; and the in-place stop dog II corresponds to the in-place stop dog I so as to be fixed on the air cylinder mounting plate. The sliding mechanism provided by the invention has the advantages of compact structure, high intensity, welding space saving, stable product quality and improved work efficiency is improved.