The geological history of the Shepton Mallet area stretches back over 300 million years. Located at the boundary between the young Jurassic rocks and the older, harder Carboniferous strata, there is a huge variety of rocks to be seen within a small area.
The oldest rocks, including the Devonian Portishead Formation, the Avon Group mudstones and the Carboniferous Limestone outcrop on the southern side of the Beacon Hill pericline. The Black Rock Limestone is exposed in several old quarries at Windsor Hill. These quarries were opened by John Wainwright and Co. Ltd. in about 1902. In this quarry the German palaeontologist Walter Kunhe obtained a specimen of Oligokyphus, a mammal-like reptile that resembled a weasel, from a fissure infilled with Jurassic Lias Group sediments. Triassic rocks outcrop around Croscombe.
Most of Shepton Mallet is built on a shelf of Jurassic Downside Stone, a near-shore (littoral) variation of the Blue Lias limestone up to 30 m thick. On the southern side of the town, the Downside Stone rests on Triassic Mercia Mudstone and Dolomitic Conglomerate. However, to the north, it oversteps the Triassic rocks and rests directly on the underlying Carboniferous Limestone between Doulting and Downside. In places erosion has cut through the Downside Stone cover to reveal the older rocks beneath, for example in the Ham Woods valley between Windsor Hill and Croscombe.
Both the Downside and the Doulting Stone have been quarried for building stone. The Downside Stone, and its lateral variant, the Chilcote Stone can be seen in several disused quarries around Downside, most of which are on private land. The largest lies just north-east of the old railway viaduct on the B3136 south of Downside and shows several metres of pale white bioclastic limestone. Another quarry in Downside, now used as a builders' yard displays the striking angular unconformity between the Downside Stone and the underlying Carboniferous Black Rock Limestone.
The rocks are also exposed in Ham Woods and in a small roadside cutting in Bowlish. Here, the interbedded pale grey limestone and thin mudstone indicate a change from a near-shore (littoral) to a more offshore, but still shallow-water setting. Farther south, Downside Stone merges with the more typical deeper water Lias Group sediments.
To the east of Shepton Mallet, the Inferior Oolite or 'Doulting Stone' is still being actively quarried around Doulting. It has been used in Wells Cathedral, Glastonbury Abbey and many local buildings. It is a working quarry so permission is needed for a site visit. However, spectacular examples of the stone can be seen on Chelynch Road by the quarry entrance. The quarries here were connected by a tramway to the East Somerset Railway.
Several small streams draining the sandstone on Beacon Hill sink underground on meeting the Carboniferous Limestone. At Thrupe Lane Swallet, a small stream sinks in an almost vertical cave system 120 m deep. The water from this and the other stream sinks resurges at the St Andrew's Risings in Wells.
Around Doulting are a group of springs that emerge from the base of the permeable Inferior Oolite where it overlies the impermeable Charmouth Mudstone. One of the springs is a holy well, named after St Aldhelm, the Bishop of Sherborne, who died here in 709.