The invention discloses a device and a method for measuring the vertical displacement of buildings, wherein using the principal of connected pipes to realize multipoint communication, the device converts small elevation variation at an equipment installation location into vertical position variation of a liquid level interface by measuring the position of the liquid level interface in a communicating container, and the vertical position variation of the liquid level interface is directly detected by a CCD sensor or a PSD photoelectric device. The functions of the CCD sensor or the PSD photoelectric device such as program control driving, signal processing and identification, data acquisition, communication with computers, etc. are implemented by using a single chip machine. The device integrates sensor and peripheral circuit and is manufactured by specially-designed moulds, thereby achieving good integrity and sealing performance and convenient installation. The device can be used for observing the vertical deformation of dam, bridge, dock, high slope, ground fissure, fault, weak intercalated layer, etc.