National Location Code
The National Location Code (NLC) is a four-digit number allocated to every railway station and  ticket issuing point in Great Britain for use with the ticketing system on the British railway network. They are used in the issue of tickets and for accounting purposes. They are a subset of the NLCs created by British Rail, which are based on four "main" digits plus two supplementary digits. Introduction by British Rail
NLCs were introduced as a method of accounting for and attributing costs and revenue to railway assets. This quotation is taken from the 14th Edition (January 1987) of the National Location Code listing book, published by the British Railways Board:

"With the widespread use of computers within British Railways and the advent of national computer systems for dealing with payroll compilation, stores recording and accounting, wagon control, traffic data, revenue and expenditure accounting, market and traffic surveys etc., the need for a standard location code became increasingly important. In order to meet this need, the Regions were asked in November 1966 to revise and update the publication then known as the Terminals and Mileage Gazetteer Code. At the same time the opportunity was taken to include all sidings, yards, depots, offices, administrative centres, etc., where there is 'railway' activity. [...] A file was developed based on a six-digit code known as the British Railways National Location Code. This was [first] published on 1 January 1968." Each six-digit code is split into two parts: the first four digits identify the location of the asset or cost centre, and the final two give more information about the specific asset. The "base" location (including all stations and ticket-issuing locations) has 00 after the first four digits; other two-digit combinations signify other types of asset, with the first four digits indicating the "base" location to which they relate. In ticket issuing, only the first four digits are used. Some examples:

 852400 is Hebden Bridge as a location, asset base and cost centre. 852405 is the Up Refuge Siding at Hebden Bridge. 8524 is shown on tickets issued at Hebden Bridge. 548400 is Crawley as a location, asset base and cost centre. 548461 is the (now disused) signalbox controlling the points and level crossings there
 548465 is the former parcels delivery agency. 5484 is shown on tickets issued at Crawley. 548500 is allocated to Crawley New Yard, a goods facility north of nearby Three Bridges station. It had additional codes based on the users of the yard, such as the National Coal Board (which maintained a coal concentration depot there until 1981) and Ready Mixed Concrete. Consequence for ticketing systems
In the 1960s and 1970s, there were various ticket issuing systems in use, some quite localised. Some had simple numerical code structures covering a limited number of stations in the relevant area, but there was no universal coding system to identify stations until the NLC was introduced. NLCs began to appear on certain types of ticket (such as the Southern Region mainstay, the NCR21) almost immediately. With the introduction of the fully computerised INTIS (Intermediate Ticket Issuing System) in the early 1980s, the four-digit version of the NLC became fully established. INTIS tickets were partly pre-printed, and the station name printed on the ticket had the NLC next to it. The machine printed the codes of the "origin" and "destination" stations on the top line of the ticket. INTIS was superseded by APTIS in 1986; the latter became the universal ticket office system for the next 15–20 years, with the last APTIS machines removed in March 2007. APTIS tickets had the NLC of the station of issue printed on their second line, irrespective of whether the journey started there - so for example, a ticket issued at Brighton (NLC 5268) for a journey from Gatwick Airport to London Victoria had 5268. An NLC covered the station and all of its associated accounting activities; it was on everything from tickets issued from self-service ticket machines to ticket office staff wage slips. Where stations on the same site needed to be treated as separate entities, they were allocated different codes. When London Waterloo's East (serving South Eastern Division destinations) began in the late 1980s to be considered as a separate station from the main London Waterloo (NLC 5598), its self-service machines got their own code, 5158. Revenue could then be apportioned correctly to the relevant Division, and, after privatisation, the correct Train Operating Company (TOC). The modern era
After the railway network was privatised in the mid-1990s, there was a need for additional NLCs to be created:
 South West Trains TOC opened Travel Centres at many of its larger stations, for booking of more complex journeys, and wanted each one to have a different code from that of the station to differentiate revenue derived from Travel Centre bookings, typically more complex and lengthy and often of high monetary value. Other TOCs did this to a lesser extent. Many TOCs began to operate Telesales facilities and, later, online booking facilities. As new ticket-issuing systems began to be rolled out to replace APTIS and the less widespread "Quickfare" self-service machines, TOCs began to use different codes to distinguish between revenue derived from ticket offices and self-service machines. With "New Generation" systems are in place throughoutthe network, the following distinction is universal:
Ticket offices use the original NLC, allocated in the 1960s;
Self-service machines use a new NLC that may have been allocated at any time since privatisation and which bears no relation to the original geographical boundaries. Example of the allocation of new codes
In 1998, Brighton was supplied with two wall-mounted touch-screen machines by Cubic Transportation Systems, Inc., issuing a limited range of tickets by credit card only; code 8882 was given to these. Subsequently, these (and the erstwhile Quickfare machines) were replaced by a six "FASTticket" touch-screen machines manufactured by Shere Ltd.; these bore NLC 8882 as well, whereas the ticket office machines ("SMART Terminal", supplied by Shere) used the station's original code, 5268. Special NLCs

Any location to which railway revenue or expenditure can be attributed was coded in the 1960s (or later, if it came into existence subsequently): codes are allocated to any location, be it fixed or mobile, that can issue tickets, and to any location that can have a ticket issued to it for a journey from a National Rail station. Some examples are:
 London Underground stations: codes run upwards from 0500, allocated alphabetically by station name. Anomalies have arisen where stations have opened or changed their name. Docklands Light Railway stops, Northern Ireland Railways and Iarnród Éireann stations have codes in the 0000 series. Portable machines used by on-train staff, originally PORTIS (Portable Ticket Issuing System), then SPORTIS (Super-PORTIS) and now PDA-based "Avantix Mobile". NLCs were allocated to depots and conductors' bases from which machines were sent out each day. Rail-appointed Travel Agencies. Back-office machines at stations or in railway offices for accounting purposes. Agencies used by local authorities to issue concessionary passes, season tickets and similar. Extra issuing points at stations: for example, excess fares windows, positions used only for season ticket renewals or business/executive travel tickets. Machines in airport terminals. Standalone travel centres away from stations, such as One Stop Travel in Brighton city centre (3644, now 2791) and the former Victoria Street Travel Centre in London (6127). Station groups. These pseudo-locations have codes in the 0200 and 0400 ranges. Original allocation of NLCs
When British Railways was created in 1948, it was split into six operating regions; these became five in the 1960s (Eastern, London Midland, Western, Southern and Scottish). The distribution of NLCs broadly followed this pattern. NLCs in the Southern Region
The Southern Region was divided into three divisions: South Eastern, Central and South Western based on the three pre-Grouping companies. NLCs were allocated (approximately) following these boundaries, as follows:

Anomalies
Since privatisation, the need for new codes has grown so much that they have largely stopped being allocated on a geographical basis, especially where additional codes are being given to a station. Where a new station is given a geographically correct code, it is usually because the station had been planned for some time and a gap was left in the appropriate section of codes. An example is Lea Green (NLC 2339), which was proposed for many years (under the name "Marshalls Cross") before being opened in 2000. Sometimes, as at Chandler's Ford, a station is reopened with its original code after being closed. When Coleshill Parkway between Birmingham and Nuneaton was opened in 2007 it was allocated 9882, which relates geographically to Scotland. Some quirks have always existed, however:
 Kensington Olympia station was given code 3092 as it was considered part of the Western Region although it was not served by any scheduled trains from that region, with only a tenuous physical connection (the little-used North Pole Junction). It passed into Southern Region control, when the only services were peak-hour shuttle trains from Clapham Junction, before passing to the Midland Region before privatisation when a Clapham Junction-Willesden Junction service began (now operated by London Overground and Southern). Skipton formed the boundary between the LMR and ER, and so could have been given a 2000-series or an 8000-series code. Although most of its services originated from the ER, it was given 2728. The North London Line (Richmond-Stratford; Richmond-North Woolwich until December 2006) crosses several regions. The first two stations, Kew Gardens and Gunnersbury, were given 5500-series codes to match Richmond. The London Underground District Line route was left for LMR territory, with 1000-series codes. Because the LMR had a terminus at Broad Street in the City of London (closed 1986), the 1000-series continued until the junction where the branch line to Broad Street left the North London Line; the junction formed the boundary between the LMR and the ER, with 6000-series codes continuing for the rest of the route. When a new station opened at Dalston Kingsland, it was given 1429, as it lay on the LMR side of the junction. The Spa Valley Railway recently completed its extension to the National Rail network at Eridge, with through ticketing. Stations were given the alpha-numeric NLCs K569, Tunbridge Wells (SpVR); K570, Groombridge (SpVR); and K571, High Rocks Halt (SpVR). Eridge retains its BR era code of 5459. References

British Rail fares and ticketing
British Rail numbering and classification systems
Databases in the United Kingdom
Fare collection systems in the United Kingdom