With the development of information technology, more and more companies have taken the initiative to build virtual brand communities to strengthen the connection between brands and customers and create brand loyalty, but existing research lacks a clear explanation of how the customer community experience of virtual brand communities affects brand loyalty. In response to this question, this paper investigates the role and mechanism of different types of community experiences, namely information experience, entertainment experience and interactive experience, generated by customers’ participation in community activities on brand loyalty based on the customer experience perspective. The findings show that different types of community experiences have a significant impact on brand loyalty, and which community identity is partially mediated in all of them. Further analysis for segmented populations in virtual communities revealed significant differences in the above mechanisms for members of different genders. The findings of this paper are important guidance for companies to manage virtual brand communities and create brand loyalty.