Purpose As knowledge management increasingly becomes critical for the success of professional service firms, this paper uses social exchange theory to investigate the interactive impact of transformational leadership and organizational innovation on online knowledge sharing by employees in professional service firms. This study aims to investigate the mediating roles of job autonomy and job engagement in this process. Design/methodology/approach Data were collected from a survey of 350 frontline employees in professional service providers, including banking, telecommunication and insurance. Structural equation modeling was used for data analysis. Findings The results show that transformational leadership positively affects job autonomy, which in turn has a positive impact on online knowledge sharing through job engagement. Thus, job autonomy and job engagement mediate the relationship between transformational leadership and online knowledge sharing. Finally, organizational innovation moderates the relationship between transformational leadership and job autonomy. Originality/value This paper extends the knowledge management literature by studying the impact of transformational leadership on the online knowledge-sharing behavior and exploring the focal roles of job autonomy and job engagement in online-sharing behavior in professional service firms. The findings also provide useful implications for practitioners to help them engage employees in the adoption of digital technologies to optimize outcomes.