The objective of this study is to assess the relationship between gallstones and venous thromboembolism (VTE), including deep vein thrombosis (DVT) and pulmonary embolism (PE), and the risk of VTE after cholecystectomy for gallstones. This nationwide population-based cohort study retrieved the hospitalization database from the Longitudinal Health Insurance Research Database (LHID2000), a database belonging to the National Health Insurance (NHI) program of Taiwan. A total of 345,793 patients aged ≥ 18 years with gallstones diagnosed between 2000 and 2010 were identified as the study cohort. The beneficiaries without gallstones were randomly selected as the control cohort by propensity score matching with the study cohort at a 1:1 ratio based on age, sex, urbanization, occupation, comorbidities, and year of the index date. We compared the risk of VTE between both cohorts and measured the risk differences of VTE between the gallstones patients with (n = 194,187) and without cholecystectomy (n = 151,606). Each patient was examined from the index date until the occurrence of DVT or PE, death or withdrawal from the NHI program, or the end of 2011. The incidence rate of DVT was 7.94/10,000 person-years for the non-gallstones cohort and 9.64/10,000 person-years for the gallstones cohort (hazard ratio (HR) = 1.35, 95% confidence interval (CI) = 1.25–1.47), respectively (p < 0.001). The incidence rate of PE was 3.92/10,000 person-years for the non-gallstones cohort and 4.65/10,000 person-years for the gallstones cohort (HR = 1.35, 95% CI = 1.20–1.53), respectively (p < 0.001). The cumulative incidence of DVT (6.54/10,000 person-years vs 14.6/10,000 person-years, adjusted hazard ratio (aHR) = 0.60, 95% CI = 0.54–0.67) and PE (3.29/10,000 person-years vs 6.84/10,000 person-years, aHR = 0.67, 95% CI = 0.58–0.77) for gallstones patients was lower in the cholecystectomy cohort than that in the non-cholecystectomy cohort after adjustment for age, sex, urbanization level, occupation, frequency of medical visits, history of pregnancy, and comorbidities (log-rank test, p < 0.001). Our findings indicate that the risk of DVT or PE in patients with gallstones was greater than those without gallstones. However, the risk of DVT and PE in the patients with gallstones would decrease after cholecystectomy. This area of research needs more studies to ascertain the pathogenesis for the contribution of gallstones to the development of VTE and the protective mechanisms of cholecystectomy against the development of VTE.