The strength and ductility of metals can severely deteriorate when exposed to hydrogen-containing environments, an effect called hydrogen embrittlement. To understand the hydrogen-resistant behavior of high-entropy alloys (HEAs), we investigated the mechanical properties and microstructural evolution of carbon-doped and undoped equiatomic CoCrFeMnNi HEAs upon pre- and in-situ hydrogen charging. We found that hydrogen below a certain concentration in the equiatomic HEA leads not to catastrophic weakening, but instead increases both, its strength and ductility. The key idea behind this turnaround lies in decreasing the stability of the face-centered cubic lattice structure of the HEA matrix via hydrogen alloying to trigger more intense nano-twinning upon loading, thereby improving strain-hardening of the alloy. On the other hand, the carbon-doped HEA, which has significantly higher strength and yet lower ductility compared to the undoped alloy, also exhibits extensive nano-twinning behavior upon hydrogen charging and mechanical loading, thus leading to excellent hydrogen resistance.