The invention is based on the aim of providing a shifting device having a locking device for locking shifting rails for a transmission of motor vehicles, the device being safe to operate and cost-effective. The invention provides a shifting device (1) for a transmission of a motor vehicle having a locking device (11), comprising a selector shaft (2) for the preselection and shifting of gears in the transmission, and having a plurality of shifting rails (9) a, b, c, d for transmitting the shifting torques from the selector shaft (2) to the transmission, wherein the selector shaft (2) is aligned perpendicular to the shifting rails (9) a, b, c, d, and is axially (3) displaceable for the preselection of gears and is disposed pivotally (4) about the own axis thereof for shifting gears, whereinthe locking device (11) has a locking section (12) for releasing one of the shifting rails (9) a, b, c, d and for locking the other shifting rails and a guide section (15) for axially guiding the locking device (11) to a guide member fixed on the housing, wherein the locking device (11) is configured and/or disposed such that it is carried along upon an axial displacement (3) of the selector shaft (2) for the preselection of the gears, and runs freely upon a pivoting (4) of the selector shaft for shifting the gears, wherein the locking section (12) is configured as a first planar sheet metal section defining a locking plane in the planar extension, and wherein a guide plane is defined as a displacement plane between the guide section (15) and the guide member, wherein the locking plane and the guide plane are arranged parallel to each other on the same side of the selector shaft (2).