Utilizing determinant quantum Monte Carlo algorithm, the evolution of the d-wave pairing in the Hubbard model on the square lattice tuned by the periodically modulated hopping amplitudes is studied. The hopping amplitudes are homogeneous in the -direction, while in the -direction the hopping amplitudes are modulated with period P, where , , and the modulation period P equals 2, 3 and 4 lattice spacings. The latter two modulation periods are motivated by the observation of period-3 and period-4 stripe order in cuprate superconductors. For all the periods P, we find that the modulated hopping inhomogeneity enhances the d-wave pairing and an optimal inhomogeneity exists.