The B class was designed as a larger, more powerful locomotive to handle mainline freight trains that were becoming too heavy for locomotives of the O, P, and T classes. The first was built in NZR's own Addington Workshops in Christchurch and entered service on 4 May 1899, and an order was placed with Sharp, Stewart and Company of Glasgow, Scotland to supply four more. The first engine from Scotland entered service on 20 December 1899, followed by the other three within the next month.