PURPOSE To stratify patients and aid clinical decision making, we developed machine learning models to predict treatment failure and radiation-induced toxicities after radiotherapy (RT) in patients with hepatocellular carcinoma across institutions. MATERIALS AND METHODS The models were developed using linear and nonlinear algorithms, predicting survival, nonlocal failure, radiation-induced liver disease, and lymphopenia from baseline patient and treatment parameters. The models were trained on 207 patients from Massachusetts General Hospital. Performance was quantified using Harrell's c-index, area under the curve (AUC), and accuracy in high-risk populations. Models' structures were optimized in a nested cross-validation approach to prevent overfitting. A study analysis plan was registered before external validation using 143 patients from MD Anderson Cancer Center. Clinical utility was assessed using net-benefit analysis. RESULTS The survival model stratified high-risk versus low-risk patients well in the external validation cohort (c-index = 0.75), better than existing risk scores. Predictions of 1-year survival and nonlocal failure were excellent (external AUC = 0.74 and 0.80, respectively), especially in the high-risk group (accuracy > 90%). Cause-of-death analysis showed differential modes of treatment failure in these cohorts and indicated that these models could be used to stratify RT patients for liver-sparing treatment regimen or combination approaches with systemic agents. Predictions of liver disease and lymphopenia were good but less robust (external AUC = 0.68 and 0.7, respectively), suggesting the need for more comprehensive consideration of dosimetry and better predictive biomarkers. The liver disease model showed excellent accuracy in the high-risk group (92%) and revealed possible interactions of platelet count with initial liver function. CONCLUSION Machine learning approaches can provide reliable outcome predictions in patients with hepatocellular carcinoma after RT in diverse cohorts across institutions. The excellent performance, particularly in high-risk patients, suggests novel strategies for patient stratification and treatment selection.