The use of lithium (Li) or sodium (Na) metal anodes together with highly ion-conductive solid electrolytes (SEs) could provide batteries with a step improvement in volumetric and gravimetric energy densities. Unfortunately, these SEs face significant technical challenges, in large part because Li and Na dendrites can penetrate through SEs, leading to short circuits. The ability of such a soft material (Li or Na metal) to penetrate through ceramic is surprising from the point of view of models widely used in the Li-battery field. We introduce a concept, new to the battery field, for preventing penetration of lithium dendrites through SEs by putting the SE surfaces into a state of residual compressive stress. For a sufficiently high compressive stress, cracks have difficulty forming, and cracks that do form are forced to close, inhibiting dendrite penetration. This approach is widely used to solve commercially important stress corrosion cracking problems in metals and static fatigue problems in ceramics and glasses (e.g., Gorilla Glass). However, the technique will not be useful for SEs if the Li-ion transport rate through a SE is substantially reduced when the SE is under compression. Our molecular dynamics calculations for Li-ion transport through a common SE demonstrate that the introduction of even very high residual compressive stresses (∼10 GPa) has only a modest effect on Li-ion transport kinetics, suggesting that this approach is viable and capable of providing a new paradigm for developing high-performance and mechanically stable SEs.