The temperature variations of the refractive index and of the linear birefringence have been studied in flux-grown nominally pure SrTiO3 and Sr1-xBaxTiO3 (SBT) single crystals (x = 0.02, 0.08 and 0.17) in the temperature range from 5 to 300 K. Polar domain structures were studied by polarizing microscopy. In SBT (x = 0.17) two phase transitions (PTs) at T-c1 = 91 K (cubic, paraelectric-to-tetragonal, ferroelectric) and T-c2 = 76 K (to orthorhombic or rhombohedral) were detected. SBT (x = 0.08) undergoes a PT at T-c = 50 K (cubic, paraelectric-to-orthorhombic or rhombohedral, ferroelectric). In the low-x limit (x = 0.02) the cubic-to-tetragonal PT of pure SrTiO3 was observed at To = 70 K. Below T-c = 28 K a polar state with C-2v symmetry and weak anisotropy was observed. Contributions of the spontaneous electro-optic effect to the temperature variation of the refractive index in SBT (x = 0.08 and 0.17) allow us to estimate the spontaneous polarization and its temperature variation.