In order to lessen the influence of indoor complex environment factors on WiFi positioning, reduce the positioning cost, improve the positioning accuracy and lock the positioning area, a WiFi indoor location algorithm based on XGBoost is proposed through in-depth analysis and discussion of the indoor positioning system and related machine learning algorithms. According to the non-uniform characteristics of WiFi signal strength distribution, this algorithm extracts WiFi intensity features and uses XGBoost to locate the signal source. Experimental results show that the positioning algorithm achieves 87.72% positioning accuracy when detecting the WiFi intensity feature, which achieves the desired positioning effect, with short positioning time, good robustness, and can meet the requirements of real-time positioning.