Oxide heterostructures are of great interest both for fundamental and applicative reasons. In particular the two-dimensional electron gas at the LaAlO3/SrTiO3 or LaTiO3/SrTiO3 interfaces displays many different physical properties and functionalities. However there are clear indications that the interface electronic state is strongly inhomogeneous and therefore it is crucially relevant to investigate possible intrinsic electronic mechanisms underlying this inhomogeneity. Here the electrostatic potential confining the electron gas at the interface is calculated self-consistently, finding that the electron confinement at the interface may induce phase separation, to avoid a thermodynamically unstable state with a negative compressibility. This provides a generic robust and intrinsic mechanism for the experimentally observed inhomogeneous character of these interfaces.PACS numbers: 73.43.Nq,73.21.Fg, The two-dimensional electron gas (2DEG) that forms at the interface of two insulating oxides, like LaAlO 3 /SrTiO 3 and LaTiO 3 /SrTiO 3 (hereafter generically referred to as LXO/STO) [1][2][3][4], exhibits a rich phenomenology, such as a gate-tunable metal-tosuperconductor transition [5][6][7][8], a magnetic-field-tuned quantum criticality [9], and inhomogeneous magnetic responses [10][11][12][13][14][15]. Tunneling [16,17] and SQUID magnetometry [18] provide clear evidence of an inhomogeneous interface on both micro-and nanoscopic scales. Transport measurements report further signs of inhomogeneity and a percolative metal-to-superconductor transition with a sizable fraction of the 2DEG never becoming superconducting down to the lowest accessible temperatures [19][20][21][22]. For both fundamental reasons and applicative purposes, like device design, it is crucial to identify possible intrinsic mechanisms that may render the 2DEG so strongly inhomogeneous via a phase separation (PS). This is precisely the focus of the present work.Here, we identify a very effective electron-driven mechanism leading to PS, based on the confinement of the 2DEG at the interface. From customary self-consistent calculations of the confining potential well in semiconductors, it is well known [23] that a finite lateral extension usually renders the 2DEG more compressible than its strictly 2D counterpart. This effect is much stronger in LXO/STO than in ordinary semiconductor interfaces, due to the huge dielectric constant of STO, allowing for much larger electron densities, with a strong amplification of the self-consistent adjustments of the confining potential. As a consequence, a non-rigid band structure arises, which varies with the local electron density: an increased electron density is accompanied by a corresponding increase of the positive countercharges (due to oxygen vacancies and/or polarity catastrophe [24][25][26][27][28][29]), from which the interfacial electrons are introduced and restoring the overall charge neutrality. For small-to-moderate increases of electron and countercharge densities the potential well deepens and the e...