The LSWR B4 class is a class of 0-4-0 tank engines originally designed for station piloting and dock shunting. They were later used extensively in Southampton Docks for nearly half a century.
The locomotives were designed by William Adams. They were unusual in having inside Stephenson valve gear but outside cylinders and coal bunkers on the footplate inside the cab. The class were originally built with Adams's design of stovepipe chimney, although these were later replaced by a lipped version designed by Adams' successor, Dugald Drummond. Some examples also had cut away cabs to improve visibility. They were designed for shunting in locations with a sharp curves, such as the dockyard at Devonport and as pilots at the major stations.
Drummond designed a similar class of five locomotives in 1907, with a slightly smaller boiler and lipped chimney. These were delivered during 1908. These locomotives were originally regarded as a new class. However, Drummond's successor Robert Urie, considered them to be so similar to the originals, that they were merged with the B4 class in 1912.
Two examples of the class have survived into preservation.