We report results of a theoretical investigation of hyperfine interactions in two homonuclear isotopologues of the hydrogen molecule: H 2 and D 2 . We present a set of hyperfine coupling constants: spin-rotation, spin-spin dipole and, in the case of the D 2 molecule, electric quadrupole coupling constants for all bound states of the two isotopologues in their ground electronic X 1 Σ + g state. We provide a list of positions and intensities of 220 997 hyperfine components of 16 079 rovibrational quadrupole transitions of the O, Q and S branches. The positions and intensities of the hyperfine components are necessary for a reliable interpretation of accurate measurements of rovibrational transition frequencies in H 2 and D 2 , which are used for tests of the quantum electrodynamics of molecules and searches for new physics beyond the Standard Model.