The main objective of this research is to provide a comprehensive insight into the optical and thermoelectric properties of layer structured Ba2XS4(X = Zr, Hf) for energy harvesting applications using Density Functional Theory (DFT) and semiclassical Boltzmann transport theory. There is a good match between the computed lattice parameters and the available experimental data. Both compounds are thermodynamically and mechanically stable and they are soft, ductile, machinable, and elastically anisotropic. The indirect band gaps are found to be 1.03 eV for Ba2ZrS4 and 1.48 eV for Ba2HfS4. Both compounds possess a mixture of ionic and covalent bonding confirmed by charge density distribution and Mulliken bond population analysis. The maximum absorption is in the ultraviolet regions ( of light spectra. The total thermal conductivity increases with temperature due to increasing trend of electronic thermal conductivity. The total thermal conductivity at 700 K along c-axis is 4.6 (6.1 W/mK) for Ba2ZrS4 (Ba2HfS4). For p-type Ba2ZrS4 (Ba2HfS4), power factor (PF) is about 7 (5.7) mW/mK2, whereas for n-type it is about 4 (3.9) mW/mK2 at 700 K along c-axis. The power factors of the studied compounds are much higher than those of the reported GeTe and SnSe which would create great interest for further study. The predicted ZT values at 700 K for p-type Ba2ZrS4 and Ba2HfS4 are 0.7 and 0.6, respectively. These values may further be improved through reduction of thermal conductivity and tuning ductility employing known suitable strategies such as alloying and nano-structuring. Finally, Ba2ZrS4 and Ba2HfS4 can be considered new eco-friendly alternatives to previously studied toxic lead-based thermoelectric materials. Their unique advantages of high thermodynamic stability, non-toxic nature and high performance make them strong candidate for sustainable energy solutions.