We present a compact scheme to solve the Cahn-Hilliard equation with a periodic boundary condition, which is fourth-order accurate in space. We introduce schemes for two and three dimensions, which are derived from the one-dimensional compact stencil. The energy stability is completely proven for the proposed scheme based on the application of the compact method and well-known convex splitting methods. Detailed proofs of the mass conservation and unique solvability are also established. Numerical experiments are presented to demonstrate the accuracy and stability of the proposed methods. (C) 2018 Elsevier Ltd. All rights reserved.