Based on first-principles calculations, we reported that external pressure can induce topological phase transition in alkaline-earth hexaborides, XB6 (X=Ca, Sr, Ba). It was revealed that XB6 is transformed from trivial semiconductors to topological node-line semimetals under moderate pressures when spin-orbit coupling (SOC) is ignored. The band inversion between B px (pz) and py orbitals at X point is responsible for the formation of node-line semimetals. Three node-line rings around X point are protected by the combination of the time-reversal and spatial inversion symmetries, and the drumhead surface bands are obtained in the interiors of the projected node-line rings. When SOC is included, tiny gaps (< 4.8 meV) open at the crossing lines, and the XB6 becomes strong topological insulators with Z2 indices (1;111). As the SOC-induced gap opening is negligible, our findings thus suggest ideal real systems for experimental exploration of the fundamental physics of topological node-line semimetals.