BACKGROUND: Both hyperkalemia and hypokalemia can lead to cardiac arrhythmias and are associated with increased mortality. Information on the predictors of potassium in individuals with diabetes in routine clinical practice is lacking. OBJECTIVE: To identify predictors of hyperkalemia and hypokalemia in adults with diabetes. DESIGN: Retrospective cohort study, with classification and regression tree (CART) analysis. PARTICIPANTS: 321,856 individuals with diabetes enrolled in four large integrated health care systems from 2012 to 2013. MAIN MEASURES: We used a single serum potassium result collected in 2012 or 2013. Hyperkalemia was defined as a serum potassium ≥ 5.5 mEq/L and hypokalemia as < 3.5 mEq/L. Predictors included demographic factors, laboratory measurements, comorbidities, medication use, and health care utilization. KEY RESULTS: There were 2556 hypokalemia events (0.8%) and 1517 hyperkalemia events (0.5%). In univariate analyses, we identified concordant predictors (associated with increased probability of both hyperkalemia and hypokalemia), discordant predictors, and predictors of only hyperkalemia or hypokalemia. In CART models, the hyperkalemia "tree" had 5 nodes and a c-statistic of 0.76. The nodes were defined by prior potassium results and eGFRs, and the 5 terminal "leaves" had hyperkalemia probabilities of 0.2 to 7.2%. The hypokalemia tree had 4 nodes and a c-statistic of 0.76. The hypokalemia tree included nodes defined by prior potassium results, and the 4 terminal leaves had hypokalemia probabilities of 0.3 to 17.6%. Individuals with a recent potassium between 4.0 and 5.0 mEq/L, eGFR ≥ 45 mL/min/1.73m(2), and no hypokalemia in the previous year had a < 1% rate of either hypokalemia or hyperkalemia. CONCLUSIONS: The yield of routine serum potassium testing may be low in individuals with a recent serum potassium between 4.0 and 5.0 mEq/L, eGFR ≥ 45 mL/min/1.73m(2), and no recent history of hypokalemia. We did not examine the effect of recent changes in clinical condition or medications on acute potassium changes.