Close-packing of spheres refers to arranging an infinite lattice of spheres so that they take up the greatest possible fraction of an infinite 3-dimensional space. Carl Friedrich Gauss proved that the highest average density that can be achieved by a regular lattice arrangement is . The Kepler conjecture states that this is the highest density that can be achieved by any arrangement of spheres, either regular or irregular.
There are two regular lattices that achieve this highest average density. They are called cubic and hexagonal close-packings, based on their symmetry (the former is the face-centred cubic lattice). Both are based upon sheets of spheres arranged at the vertices of a triangular tiling; they differ in how the sheets are stacked upon one another. In both arrangements each sphere has twelve neighbors. For every sphere there is one gap surrounded by six neighbors (octahedral) and two smaller gaps surrounded by four neighbors (tetrahedral).
Many crystal structures are based on a close-packing of atoms, or of large ions with smaller ions filling the spaces between them. The cubic and hexagonal arrangements are very close to one another in energy, and it may be difficult to predict which form will be preferred from first principles.