Abstract: A displacement measuring device includes a body which is movable on a plurality of rails and driven by a first shaft. An extension portion is connected to the body and a second shaft connected to the body extends through the extension portion. A first gear and a second gear are respectively mounted to the first shaft and the second shaft. Both of the two gears are engaged with a rack. A spring is received in the extension portion and pushes the second gear so that the second gear is pushed toward the rack. The second gear is snugly engaged with the rack so that the tolerance therebetween is reduced. A counting member is connected to the second shaft so that the number of the revolution of the second gear is counted and the sum of the displacement of the object can be precisely calculated.