The different railway companies in Germany have used various schemes to classify their rolling stock.
From the beginning
As widely known the first few locomotives had names. The first locomotive in public service in Germany from 1835 was named Adler. The first railway lines were built by privately owned companies. That changed later when many railway companies were taken over or founded by the respective German states such as Prussia, Bavaria, etc.
The fast-growing number of locomotives made a numbering scheme inevitable. Most of the various state-owned German railway companies developed their own schemes, e. g. the Prussian state railways introduced P for passenger train locomotives, S for Schnellzug locomotives, G for Güterzug locomotives and T for Tenderlokomotive. Basically the numbers were used continuously. As the Prussians also standardised technical standards, some of the smaller companies also used the Prussian numbering scheme or a similar one. Bavaria's state-owned railway chose a different way: They also used P, S, or G to indicate the train type, but combined with the numbers of driving axles and of the axles in total, separated by a slash. E. g., the famous S 3/6 was a 2'C1' or 4-6-2 Pacific, meaning that of a total of 6 axles, 3 were driving axles. These various state-owned companies and thus their numbering schemes were retained after German unification in 1871 and kept until well after World War I.
The first uniform scheme
The Deutsche Reichsbahn-Gesellschaft DRG was founded in 1924 by the amalgamation of the various state-owned Länderbahnen. One of its first tasks was to introduce a numbering scheme that allowed to integrate the existing various pre-DRG classes.
Steam locomotives
For steam locomotives, the system was purely numeric. Every locomotive received a unit number, consisting of the number for the class, and an ordering number, separated by a space. The class numbers 01 to 19 indicated express traintender locomotives, numbers 20 to 39 passenger train tender locomotives, 40 to 59 freight train tender locomotives, 60 to 79 passenger train tank locomotives, 80 to 96 freight train tank locomotives, 97 rack locomotives, 98 Lokalbahn locomotives and 99 for narrow gauge locomotives. Besides, the DRG constructed the so-called Einheitslokomotiven to renew rolling stock and to overcome the expensive necessity of keeping dozens of different classes with hundreds of different parts. For example, Class 01 was the first class of unified express train locomotive, and the first unit of this class received the number 01 001.
In addition, similar numbering schemes were introduced for electric and diesel locomotives, but with prefix letters E for electrics and V for diesels. For electric locomotives, the class numbers roughly followed the scheme for steam locomotives, e. g. E 18 22 was a locomotive from the class E 18 introduced in 1935. Diesel locomotives received class numbers indicating one tenth of the horsepower rating, e. g. V 80 001 was the first unit of class V 80 introduced by the DB in 1953 with originally 800 hp.
Multiple units and railcars
Electric and diesel railcars and multiple units were designated by prefix letters ET and VT, respectively. The numbering schemes for those were originally derived from the numbering scheme for passenger carriages. However, in 1940 a system using class and ordering numbers, like for locomotives, was introduced for electric multiple units. A plan to introduce a similar system for diesel railcars and multiple units was put on hold due to World War II; in post-war Western Germany, the Deutsche Bundesbahn eventually followed through while in Eastern Germany, the Deutsche Reichsbahn continued to use the pre-war system for pre-war vehicles while starting off several new numbering plans for post-war units over the years, thus ending up with a hodge-podge of conflicting schemes for diesel railcars and multiple units until 1970.
IT compatible numbering schemes
Due to the introduction of computers/IT in the late 1960s it became necessary to revise the numbering schemes, as the old numbers could not tell whether a class 10 might be a steam or an electric locomotive without including the prefix letters, which were difficult to process by computers of the day. Another problem was both class and ordering numbers could vary in length under the old system.
DB numbering scheme
The Deutsche Bundesbahn in Western Germany decided to use three-digit class numbers, with first digit 0 for steam engines, first digit 1 for electric locomotives, first digit 2 for diesel engines, first digit 4 for EMUs, first digit 5 for battery-powered EMUs, first digit 6 for DMUs, first digit 7 for rail busses and service vehicles. Ordering numbers were uniformly three-digit as well and a check digit separated by a hyphen was added to the end, resulting in a uniform length of seven digits for all unit numbers. Thus, e. g. the old electric express locomotiveE 18 22 received the new number 118 022-3. The new DB system came into effect January 1, 1968 and effectively continues to be in use today.
DR numbering scheme
In contrast, the Deutsche Reichsbahn in Eastern Germany also introduced a numbering scheme with seven-digit unit numbers, but continuing to use two-digit class numbers for steam locomotives and three-digit class numbers for diesel and electric vehicles. As a further contrast to the new DB system, the DR decided to use the first digit 1 for diesel and the first digit 2 for electric vehicles. Therefore, e. g. the DRG-built E 44 class was renumbered 144 by the DB and 244 by the DR. To avoid clashes between steam and electric/diesel unit numbers, steam locomotive class numbers in the 10-19 and 20-29 number ranges were reassigned to the 01-09 and 30-39 number ranges, respectively. This new DR system came into effect January 1, 1970.
After German reunification the DB number scheme was also introduced to DR locomotives, thus creating some numbers that were used again, with Class 220. Some numbers had to be changed to avoid double numbers, e. g. former Class 211 became Class 109.