Motivating people to contribute knowledge to others has become a major challenge in knowledge management. To help understand knowledge contribution in virtual communities (VCs)—a popular area for knowledge sharing, this study investigates individuals’ motivations to contribute knowledge based on the nature of knowledge contribution behavior. In particular, the influences of two key moderating variables which have been neglected in most previous studies are examined. The theoretical model is empirically tested using data collected from 363 VC members. We find that reciprocity, reputation, knowledge self-efficacy, enjoyment in helping others and commitment are key factors of four kinds (egoism, altruism, collectivism and principlism) that significantly and directly influence individuals’ knowledge contribution intention in VCs. Perceived value of knowledge (PVK) is found to be an important moderator of the relationships between reciprocity, enjoyment in helping others and knowledge contribution intention. We confirm that commitment reduces the impact of reputation on knowledge contribution intention. Implications for both researchers and practitioners are discussed.