Skip to content
Alpha — Headcode is currently in alpha. APIs and data may change without notice.

Headcodes Explained

A “headcode”, also known as a train reporting number, is a four-character identifier used across the UK rail network to identify a train service. Every scheduled service, freight movement, and light engine movement is assigned one.

Headcodes originated around 1850 as physical oil lamps mounted on the front of locomotives. Signalmen used the lamp positions to identify the type and priority of an approaching train. Each railway company maintained its own codes until the Railway Clearing House standardised them across the network.

When the four-character alphanumeric format was introduced in 1960, it merged the older lamp-based headcode system with textual reporting numbers into a single identifier. Locomotives displayed these on roller-blind panels until 1976, when centralised power signalling made the physical display unnecessary on most routes.

Today, headcodes are no longer shown on the outside of most trains, but they remain central to timetabling, signalling systems, and delay attribution.

A headcode follows the format: [Class][Destination][ID][ID]

For example, in 1S35:

PositionCharacterMeaning
1st1Train class — express passenger
2ndSDestination region — Scotland
3rd–4th35Individual service identifier

The first digit indicates the class of service, which determines the train’s priority and permitted line speed.

ClassDescription
0Light locomotives
1Express passenger, postal/parcels, breakdown and test trains
2Ordinary and suburban passenger, driver training
3Rail head treatment trains, priority empty coaching stock and freight
4Freight — up to 75 mph
5Empty coaching stock (ECS)
6Freight — up to 60 mph
7Freight — up to 45 mph
8Freight — up to 35 mph
9Special express passenger services

The second character is a letter indicating the train’s destination area.

For inter-regional services, standardised letters represent broad regions:

LetterRegion
EEastern
LAnglia
MMidland
OSouthern
SScotland
VWestern

For intra-regional services, remaining letters indicate specific destination zones or routes within a region.

Some letters have special meanings:

LetterMeaning
QTrack recording trains
XOut-of-gauge loads, Royal Train, or other special requirements
ZCharters, railtours, emergency trains, and other special services

Service identifier (third and fourth digits)

Section titled “Service identifier (third and fourth digits)”

The last two digits distinguish individual services sharing the same class and destination. Headcodes tend to be sequential, so consecutive numbers often represent consecutive departures on the same route.

On frequent services, numbers are reused throughout the day. For example, 1R25 might be used for the 09:00, 15:00, and 21:30 departures on the same route.

Route letters apply in both directions, with odd and even service numbers typically distinguishing the direction of travel.

Headcodes are not guaranteed to be unique across the network. The same headcode can be assigned to different services in different regions, or reused at different times of day. For example, 1M11 might identify both a sleeper service and a daytime departure from the same origin.

Within signalling and timetabling systems, headcodes are combined with origin codes and timetable version identifiers to form longer unique references, but the four-character headcode alone should not be assumed to map to a single service.

  • Empty coaching stock movements use class 5 with the same last three characters as the passenger service they are forming or have completed. For example, 5M11 is the empty stock positioning move for 1M11.
  • Light engine movements use class 0 with the last three characters of the service the locomotive is working towards. A freight service 6A30 running without wagons becomes 0A30.
  • Freight reclassification — a freight headcode may change based on the actual load. A 6A30 (60 mph freight) could run as 7A30 if restricted to 45 mph, or as 0A30 if running light.
  • Special movements often encode the locomotive class in the service digits. For example, 0Z66 is likely a Class 66 light engine movement.
  • Rescue trains — the headcode 1Z99 is reserved for any train providing assistance to another, including rescue locomotives, breakdown cranes, snow ploughs, and overhead line equipment. These are given highest priority.

The Headcode API uses the headcode as one of its primary service identifiers, allowing you to look up train services and track their progress using this familiar signalling ID.