Purpose Humans are largely influenced by the environment in which they work, and the positive environment offers positive outcomes. Building on these lines, this study aims to propose and empirically investigate the relationship of fun on employees’ knowledge sharing behavior. The study also proposes and empirically tests the mediation mechanism of psychological empowerment and boundary condition of person–environment fit. Design/methodology/approach Considering the nature of the study, the data is collected from employees working in information technology firms at two points of time. At first point of time 600 questionnaire were distributed while at the end of second point of time all in all 313 useful responses were available for data analysis purpose. Findings The statistical analysis reveals that fun improves the psychological state of individual and in turn they share more knowledge. The findings also highlight that person–environment fit strengthens the relationship. Originality/value Based on the findings the study highlights some important theoretical and practical implications. The future direction is also provided based on these lines.