So far essentially all black hole masses in X-ray binaries have been obtained by observing the companion star’s velocity and light curves as functions of the orbital phase. However, a major uncertainty is the estimate of the orbital inclination angle of an X-ray binary. Here we suggest to measure the black hole mass in an X-ray binary by measuring directly the black hole’s orbital motion, thus obtaining the companion-to-black hole mass ratio. In this method we assume that accretion disc wind moves with the black hole and thus the black hole’s orbital motion can be obtained from the Doppler velocity of the absorption lines produced in the accretion disc wind. We validate this method by analysing the Chandra/High Energy Transmission Grating observations of GRO J1655−40, in which the black hole orbital motion (KBH= 90.8 ± 11.3 km s−1) inferred from the Doppler velocity of disc wind absorption lines is consistent with the prediction from its previously measured system parameters. We thus estimate its black hole mass () and then its system inclination (), where MBH does not depend on i. Additional observations of this source covering more orbital phases can improve estimates on its system parameters substantially. We then apply the method to the black hole X-ray binary LMC X-3 observed with Cosmic Origins Spectrograph (COS) on board the Hubble Space Telescope (HST) near orbital phase 0.75. We find that the disc wind absorption lines of C iv doublet were shifted to ∼50 km s−1, which yields a companion-to-black hole mass ratio of 0.6 for an assumed disc wind velocity of −400 km s−1. Additional observations covering other orbital phases (0.25 in particular) are crucial to ease this assumption and then to directly constrain the mass ratio. This method in principle can also be applied to any accreting compact objects with detectable accretion disc wind absorption line features.