With the rapid expansion of internet accessibility, children urgently need to be educated in online safety skills. We conducted a randomized controlled trial (RCT) with 1399 students from 22 junior high schools in Vietnam to assess the impact of an online safety program on their online behaviors. We designed our experiment to capture both the direct and spillover effects of the training program. We combined the RCT with list experiments, an indirect questioning method, to mitigate bias in the measurement of sensitive outcomes. Our impact estimates show the positive effects of the program. Specifically, participation in the program reduced students' identity disclosure on social networking sites (SNSs) by 9.3–16.8 percentage points, increased their online account security practices by 8.9–17.9 percentage points, and decreased their interactions with strangers online by 13.6–23.4 percentage points. Notably, using outcomes measured by the list experiments, we show that the program reduced sensitive and risky online behaviors by 34.7–47.0 percentage points, a result that would not have been revealed with conventional direct questioning. We also observed evidence of spillover effects on nonparticipants in the same schools. Our findings support the implementation of educational programs to enhance children's online safety.