Since the K-Means algorithm was proposed, it has been widely concerned by researchers. Its advantage lies in its simplicity and efficiency, but it also has shortcomings. Aiming at the problems that random selection of initial clustering centers in K-Means algorithm may lead to the algorithm falling into a local optimal solution, making the clustering results unstable and the K-value need to be determined manually, an improved K-Means text clustering algorithm based on BERT and density peak value is proposed(BD-K-Means). First, the BERT model is used to generate the vector representation of the text, and then the density peak clustering algorithm is used to obtain the cluster center. However, aiming at some shortcomings of the density peak clustering algorithm, the Gini coefficient is introduced to find the best cutoff distance, and then the clustering center is obtained from adaptation through the drop change ratio. Finally, the obtained initial centroid and k-value are input into the K-Means algorithm. The experimental results show that the algorithm is better than K-Means algorithm, K-Means++ algorithm, DBSCAN algorithm and DCC-K-Means algorithm in F1 value and ARI value. It can effectively improve the text clustering effect and make the clustering result more accurate.