In this paper, we present binding energies between an atom of hydrogen (H), carbon (C), nitrogen (N) and oxygen (O) with a vacancy in the hexagonal closedpacked (HCP) lattice of titanium (Ti) and the face centered cubic (FCC) lattice of aluminum (Al), calculated using the density functional theory (DFT). We have also investigated the trapping of up to five hydrogen atoms by a vacancy and the reduction of the vacancy formation energy, due to the formation of a hydrogen–vacancy complex. We used the molecular-dynamics modeling with consecutive relaxation at 0 K to obtain an atomic configuration of the vacancy–impurity complex, corresponding to the global energy minimum. According to our calculations, C–V, H–V, C–(H–V), N–(H–V) complexes are stable in the Al lattice with only H–V complex being stable in Ti. The formation of C–(H–V) and N–(H–V) complexes in the Al lattice results in the negative vacancy formation energy. The formation of H–V complex decreases the vacancy formation energy by 0.26 eV in the Ti lattice. A vacancy in the Ti lattice can trap up to four hydrogen atoms.