Abstract WiFi-based indoor fingerprint localization is widely used in indoor localization owing to its high accuracy and low deployment costs. Changes in the indoor signal environment directly affect localization accuracy. To improve localization accuracy and stability, this paper proposes a novel indoor fingerprint localization algorithm based on Weighted K-Nearest Neighbors (WKNN) and an enhanced Light Gradient Boosting Machine (LightGBM). First, in the offline phase, Gaussian filtering and K-Nearest Neighbors-Random Forest information completion algorithm with fusion of Euclidean and Manhattan distances are used to remove outliers from the fingerprint database dataset and fill in missing fingerprint information, ensuring the integrity of the fingerprint database. During the online phase, the fingerprint database is divided into training and testing sets. The LightGBM algorithm is used for modeling. Additionally, Genetic Algorithm (GA) is use d to optimize the parameters of LightGBM algorithm to find the best parameters by fitness evaluation. Then, the nearest neighbor set found by the WKNN algorithm is introduced into the LightGBM-GA model. Combining the predictions from the standalone LightGBM algorithm and performing weighted fusion yields the final predicted coordinates. The experiments are conducted in 8 m × 10 m laboratory containing 5 access points and 80 reference points to collect the Received Signal Strength Indication values of 5 WiFi hotspots. The experimental results show that the average localization error of the proposed algorithm is 1.11 m, which is reduced by 6.7%–38.3% compared to K-Nearest Neighbors (KNN), Extreme Gradient Boosting (XGBoost), LightGBM, KNN + XGBoost, WKNN + LightGBM, and WKNN + XGBoost-GA localization algorithms. The localization curve is smoother, and the cumulative distribution function converges faster. Moreover, the localization time is reduced by 13.3%–36.7%, effectively enhancing localization accuracy and decreasing localization time.