BaTiO 3 ultrathin films (thickness ≈ 1.6 nm) with in-and out-of-plane polarization are studied by first-principles calculations. Out-of-plane polarization is simulated using the method proposed by Shimada et al. [Phys. Rev. B 81, 144116 (2010)], which consists in building a supercell containing small domains with alternating up and down polarization. This allows one to investigate the properties of defect free BaTiO 3 ultrathin films with polarization perpendicular to the surface, as a function of in-plane lattice constant, i.e., epitaxial strain. The configurations with polarization perpendicular to the surface (c phase) are found stable under compressive strain, while under tensile strain, the polarization tends to lie in-plane (aa phase), along [110]. In the c phase, the most stable domain width is predicted to be 1 to 2 lattice constants, and the magnitude of the surface rumpling varies according to the direction of the polarization (upwards versus downwards), though its sign is unchanged, the oxygen anions pointing in all cases outwards. Finally, all the surfaces studied are found to be insulating. Analysis of the atom-projected electronic density of states gives insight into the surface contributions to the electronic structure. An important reduction of the Kohn-Sham band gap is predicted at TiO 2 terminations in the c phase (≈ 1 eV with respect to the aa phase). The Madelung potential at the surface plays the dominant role in modifications of the surface electronic structure.