BACKGROUND: Online patient portals are being widely implemented, but their impact on health behaviors are not well-studied. OBJECTIVE: To determine whether statin adherence improved after initiating use of the portal refill function. RESEARCH DESIGN: Observational cohort study within an integrated health care delivery system. SUBJECTS: Diabetic patients on statins who had registered for online portal access by 2010. A total of 8705 subjects initiated the online refill function use within the study window, including exclusive and occasional users (ie, requesting all vs. some refills online, respectively). Using risk-set sampling, we temporally matched 9055 reference group patients who never used online refills. MEASURES: We calculated statin adherence before and after refill function initiation, assessed as percent time without medications (nonadherence defined as a gap of >20%). Secondary outcome was dyslipidemia [low-density lipoprotein (LDL)≥ 100]. Difference-in-differences regression models estimated pre-post changes in nonadherence and dyslipidemia, comparing refill function users to the reference group and adjusting for age, sex, race/ethnicity, medications, frequency of portal use, and outpatient visits. RESULTS: In unadjusted examinations, nonadherence decreased only among patients initiating occasional or exclusive use of the refill function (26%-24% and 22%-15%, respectively). In adjusted models, nonadherence declined by an absolute 6% (95% confidence interval, 4%-7%) among exclusive users, without significant changes among occasional users. Similar LDL decreases were also seen among exclusive users. CONCLUSIONS: Compared with portal users who did not refill medications online, adherence to statin medications and LDL levels improved among diabetic patients who initiated and exclusively used the patient portal for refills, suggesting that wider adoption of online refills may improve adherence.