We introduce a fractional variant of the Cahn–Hilliard equation settled in a bounded domain and with a possibly singular potential. We first focus on the case of homogeneous Dirichlet boundary conditions, and show how to prove the existence and uniqueness of a weak solution. The proof relies on the variational method known as minimizing movements scheme, which fits naturally with the gradient-flow structure of the equation. The interest of the proposed method lies in its extreme generality and flexibility. In particular, relying on the variational structure of the equation, we prove the existence of a solution for a general class of integrodifferential operators, not necessarily linear or symmetric, which include fractional versions of the q-Laplacian.In the second part of the paper, we adapt the argument in order to prove the existence of solutions in the case of regional fractional operators. As a byproduct, this yields an existence result in the interesting cases of homogeneous fractional Neumann boundary conditions or periodic boundary conditions.