The axial imaging range of optical microscopy is restricted by its fixed working plane and limited depth of field. In this paper, the axial capabilities of an off-the-shelf microscope is improved by inserting a liquid lens, which can be controlled by a driving electrical voltage, into the optical path of the microscope. First, the numerical formulas of the working distance and the magnification with the variation of the focus of the liquid lens are inferred using a ray tracing method and conclusion is obtained that the best position for inserting a liquid lens with consistent magnification is the aperture plane and the rear focal plane of the objective lens. Second, with the liquid lens embedded in the microscope, the numerical relationship between the magnification and the working distance of the proposed flexible-axial-capability microscope and the liquid lens driving voltage is calibrated and fitted using the inferred numerical formulas. Third, techniques including autofocus, extending depth of field and three-dimensional imaging are researched and applied, improving the designed microscope to not only flexibly control its working distance, but also to extend the depth of field near the variable working plane. Experiments show that the presented flexible-axial-capability microscope has a long working distance range of 8 mm, and by calibrating the magnification curve within the working distance range, samples can be observed and measured precisely. The depth of field can be extended to 400 μm from the variable working plane and is 20 times that of the off-the-shelf microscope.