What are headcodes on trains?
It won't take very long for you to be looking at trains, timetables or Facebook groups before you come across mentions of phrases like 4E39 or 5V23. To the untrained eye, they almost look like typos, but what do they mean?
They are a method of describing a service: an operational ID used to identify the class, destination region, and service identifier.
The origins of headcodes
When lamps were lit with oil, trains ran on coal, and railway signals were physical boards, trains had to communicate with signal boxes to identify themselves. They did this with a series of lights and/or white discs on the train. Using 4 lamps/discs placed at the head of the train (the front of it), you could communicate the type of train that was approaching. These discs confirmed to signalers their class as they passed through block sections, as trains were only tracked section by section.
The pattern of the lights would indicate an express passenger, a stopping passenger, freight, or ECS (empty coaching stock). These indicators provided visual confirmation that the train was passing through the section.
The lamps told you the class of train, but you couldn't infer its destination or train identifier in all cases.
1960s headcode evolution
In the 1960s, British Railways merged this headcode information with the destination region and identifier, creating a single standard identifier across the network. They produced these 4-character identifiers. Initially, they were to be displayed on the front of trains, although with the development of electrical signalling, this requirement was largely dropped by the 1970s.

Headcode shown on the front of a Warship at the Greatest Gathering in 2025. 0Z52. The zero would indicate the locomotive was travelling light (nothing in tow), Z would indicate that the service is special in its nature and the 52, is the service identifier.
This is the system still in use today, even though it's no longer displayed on the front of the train. These days, it is used within signalling and control systems.
What do the numbers mean?
There are 3 core components to it:
- The first digit is a train type.
- The second is the destination region.
- The last 2 are a service identifier.
Train type
The first digit is a 0-9. This helps identify the train priority. Express trains take priority over stopping trains, which take priority over freight trains.
- Class 1 - express passenger
- Class 2 - ordinary passenger
- Class 3 - parcels / special (largely historic, now rare)
- Class 4 - fast freight (up to ~75 mph)
- Class 5 - empty coaching stock (ECS)
- Class 6 - medium freight (~60 mph)
- Class 7 - slower freight (~45 mph)
- Class 8 - heavy/slow freight (~35 mph)
- Class 9 - special high-speed or special services
- Class 0 - light locomotives
Destination region
British Rail divided the country into sections: E is eastern, V is western, and so on. The letter doesn't provide a detailed description of the train; it only outlines the rough operational region.
- E: Eastern
- L: Anglia
- M: Midland
- O: Southern
- S: Scotland
- V: Western
- X/Z: Special use
Service identifier
The last 2 digits are almost random, but in many cases they are sequential because headcodes can be reused. This number only needs to be unique within the service area at that specific time.
Reuse
You board a train at Grays on the C2C, which is travelling to Fenchurch Street. This service stops at every station on the route. This service runs every hour during off-peak. The headcode is essentially the same, except for the service number. The service number would increase.
When you've run 99 of the same service (which happens on the Elizabeth line), the number resets to zero due to operational constraints. If this were not allowed, certain train services would be severely limited.
Headcodes are not a unique identifier
They are a description of the service, not a unique identifier of a train. If you look at 1E42, you will see it showing trains from Chester to Leeds and Edinburgh to King's Cross on the same day.
The Western showing in the picture shows the headcode 1V95; in this case, 1 would indicate an express passenger train, V would indicate it is travelling to the western region (so likely departed London), and 95 would be the service identifier.