The South African Railways Class 5B 4-6-2 of 1904 was a steam locomotive from the pre-Union era in the Cape of Good Hope. In 1904, the Cape Government Railways placed four Karoo Class 4-6-2 Pacific type passenger steam locomotives in service. In 1912, when they were assimilated into the South African Railways, they were renumbered and classified as Class 5B.