A space-saving locking device for a server cabinet which does not present sharp edges to a user during handling locks a first housing to a second housing and includes first and second locking members. The first locking member includes a clamping portion with one end defining a latching slot, the second locking member includes a locking portion matching the latching slot. When the first locking member is operated, the locking portion is latched to the latching slot, and the first locking member is locked to the second member. When the latching slot is detached from the latching portion in a predetermined direction, the first locking member and the second locking member are unlocked.