To align the herbal fingerprints from liquid chromatography-high resolution mass spectrometry (LC-HRMS) more accurately, an algorithm based on sub-window factor analysis (SFA-HRMS) was proposed in this paper. Initially, transforming raw files into equidistant matrices based on region of interest (ROI) searching and fuzzy matching. And Haar continuous wavelet transform (Haar CWT) was used for peak detection in diffusion enhancement signals subsequently. Then bi-directional eigenvalues between two moving sub-windows were determined to obtain the optimum shifts of each candidate peak. That is to say, two types of eigenvalues were calculated for mass spectra (m/z dimension) and diffusion profiles (rt direction) in this critical step, respectively. The last step in SFA-HRMS algorithm, moving the peak zone and keeping the peak shape as much as possible. As a result, three kinds of LC-HRMS fingerprints were aligned by SFA-HRMS algorithm succesfully, including LC- quadrupole time-of-flight mass spectrometry (qTOF MS), ion trap time-of-flight mass spectrometry (IT TOF MS) and Orbitrap mass spectrometry (Orbitrap MS). Comparing with those of XCMS-online, similar behaviors may be observed in the LC-qTOF MS fingerprints from Radix Bupleuri. Even for LC-IT TOF MS signals with burrs, accurate alignments can also be achieved in the fingerprints under two ionization modes. So then twelve sets of Fructus Aurantii samples were classified by hierarchical cluster analysis and functional principal components analysis. The next LC-Orbitrap MS fingerprint from herbal preparation was also discussed. In summary, SFA-HRMS provides new ideas for peak alignment of LC-HRMS fingerprints from complex herbal samples.