Community structure plays an important role in social networks, which can reveal potential social relationships and deliver vast economic benefits to enterprises and organizations. Many efficient community detection algorithms have been proposed by researchers. However, effective community detection algorithms are accompanied by a growing problem of privacy disclosure. People have started to worry that their private information will be overexposed by community detection algorithms, so determining how to hide the community structure in the network to resist community detection algorithms has become an important issues. In view of this, we develop effective strategies to attack community detection algorithms through invisible disturbances to the network, namely, adding and removing a small number of connections, thus achieving privacy protection. In particular, a hiding strategy named “community hiding based on genetic algorithms using NMI (CGN)” is proposed in this paper. The algorithm uses normalized mutual information (NMI) as the fitness function and achieves an efficient global hiding effect by introducing a gene pool with prior information. We launched attacks based on CGN against four community detection algorithms on multiple real-world networks. By comparing with several state-of-the-art baseline algorithms, our CGN achieved the optimal results in NMI reduction. By visualizing the attack effect, it is proven that our CGN can achieve the community division error of nodes irrelevant to the connection changes by changing a very small number of connections, which fully reflects the concealment of community hiding. In addition, we further test the transferability and find that the modified network obtained by CGN on a specific community detection algorithm also shows extraordinary hiding effects when extended to other algorithms.