INTRODUCTION: As the penetration rate of renewable energy increases and patterns of energy demand evolve, fluctuations on both the supply and demand sides of electricity are becoming more pronounced. Consequently, accurate forecasting of community residential electrical loads has become crucial. OBJECTIVES: Although the widespread adoption of smart meters among residents provides abundant data for model training, strict challenges arise during the training process due to the need for privacy protection and data security. METHODS: This paper proposes a privacy-preserving community residential short-term electric load forecasting method based on federated learning. Initially, the method applies shared random masking encryption to the sensitive data of community residents, ensuring data privacy while maintaining consistency with the original data after preprocessing. Subsequently, a private data aggregation scheme is established to perform dynamic clustering of the community’s electrical load. RESULTS: The clustered model then serves as the basis for establishing individual load forecasting models for each category of community residents to predict short-term electrical loads. Finally, an empirical analysis is performed using the electrical load data from 120 households across 6 communities in a city in Southern China. CONCLUSION: The analysis demonstrates that the proposed method can achieve the prediction of community residential electrical loads without sharing residents’ data, thus verifying the effectiveness of this approach.