Using first-principles methods, we investigate the dielectric constants of free-standing ultrathin SrTiO3 film and the dielectric response of SrTiO3 interfaced with various metal electrodes. By examining dipole moments induced by an external electric field, we evaluate the dielectric constant of SrTiO3 slabs with nanometer thicknesses. The dielectric constant of ultrathin SrTiO3 is found to be substantially smaller than that of bulk SrTiO3 and is also influenced by surface relaxation. On the other hand, the dielectric response of the metal-insulator structure shows a strong dependence on the metal electrodes; the SrRuO3 electrode is found to interfere with the dielectric response to a lesser extent than the Pt electrode. These findings are consistent with previous experimental observations.