A sort code is a number which represents a bank branch and intended for internal processing. In some cases, the first digit of the sort code identifies the bank itself and in other cases the first 2 digits identify the bank.
Also the name of such a code varies. It identifies both the bank, and the branch where the account is held. The Extended Industry Sorting Code Directory (EISCD)
The EISCD is a comprehensive database of payments-related information for financial institutions participating in the UK Payment Schemes: Bacs, CHAPS, Faster Payments and Cheque and Credit Clearing.