In this paper we prove a higher dimensional analogue of Carleson’s $\varepsilon ^{2}$ conjecture. Given two arbitrary disjoint Borel sets $\Omega ^{+},\Omega ^{-}\subset \mathbb{R}^{n+1}$ , and $x\in \mathbb{R}^{n+1}$ , $r>0$ , we denote \( \varepsilon _{n}(x,r) := \frac{1}{r^{n}}\, \inf _{H^{+}} \mathcal{H}^{n} \left ( ((\partial B(x,r)\cap H^{+}) \setminus \Omega ^{+}) \cup (( \partial B(x,r)\cap H^{-}) \setminus \Omega ^{-})\right ), \) where the infimum is taken over all open affine half-spaces $H^{+}$ such that $x \in \partial H^{+}$ and we define $H^{-}= \mathbb{R}^{n+1} \setminus \overline{H^{+}}$ . Our first main result asserts that the set of points $x\in \mathbb{R}^{n+1}$ where \( \int _{0}^{1} \varepsilon _{n}(x,r)^{2} \, \frac{dr}{r}< \infty \) is $n$ -rectifiable. For our second main result we assume that $\Omega ^{+}$ , $\Omega ^{-}$ are open and that $\Omega ^{+}\cup \Omega ^{-}$ satisfies the capacity density condition. For each $x \in \partial \Omega ^{+} \cup \partial \Omega ^{-}$ and $r>0$ , we denote by $\alpha ^{\pm }(x,r)$ the characteristic constant of the (spherical) open sets $\Omega ^{\pm }\cap \partial B(x,r)$ . We show that, up to a set of $\mathcal{H}^{n}$ measure zero, $x$ is a tangent point for both $\partial \Omega ^{+}$ and $\partial \Omega ^{-}$ if and only if \( \int _{0}^{1} \min (1,\alpha ^{+}(x,r) + \alpha ^{-}(x,r) -2) \frac{dr}{r} < \infty . \) The first result is new even in the plane and the second one improves and extends to higher dimensions the $\varepsilon ^{2}$ conjecture of Carleson.