In both cases , the cooling surface of the mass of hot lava cracked in a hexagonal pattern in a similar way to drying mud cracking as it shrinks . These cracks slowly extended down into the mass of lava as it cooled and shrank to form the columns , which were later exposed by erosion . In both cases , the cooling surface of the mass of hot lava cracked in a hexagonal pattern in a similar way to drying mud cracking as it shrinks , and these cracks gradually extended down into the mass of lava as it cooled and shrank to form the columns , which were subsequently exposed by erosion .