Trace moisture was firstly measured in methanol, ethanol and n-propanol at room temperature. The N, P-codoped carbon dots (CDs) were prepared by one pot solvothermal method, which displayed solvent-dependent fluorescence. The N, P-codoped CDs exhibited green fluorescence, with the quantum yields (QY) of 27.9%, 37.4%, 26.2% and 2.3% in methanol, ethanol, n-propanol and water, respectively. Based on the hydrogen bond interactions between the protic solvents and the N, P-codoped CDs, with the water content increased, the fluorescence intensity of N, P-codoped CDs gradually decreased in methanol, ethanol and n-propanol. The decrement in the fluorescence intensity is linearly related to the water content within the content range of 2% to 8%, 0.04% to 5% and 0.04% to 1.0%, with a limit of detection of 0.22%, 0.009% and 0.021% in methanol, ethanol and n-propanol, respectively. Therefore, the present system has a prospective value for the application in the determination of trace water in the relevant fields.