Team Fortress 2 has nine different classes that can be grouped into three combat types: offensive, defensive, and support. However, players have the freedom to play these classes in different ways based on their preferred strategy.
The offensive classes (Scout, Soldier, and Pyro) are focused on attacking and capturing key points on the map. They are known for their mobility, with the Scout having the ability to capture points quickly and the Soldier having a devastating Rocket Launcher. The Pyros can cause fiery havoc with their weapons and offer the highest speed/health ratio.
Defensive classes (Demoman, Heavy, and Engineer) are meant to hold enemies back and protect vital points. They have the most firepower of all the groups and can use weapons such as stickybombs and Sentry Guns.
The support classes (Medic, Sniper, and Spy) provide backup and special abilities to the offensive and defensive classes. They are crucial in tipping the balance of the game, with the Medic providing healing, the Sniper eliminating key targets, and the Spy infiltrating enemy lines.
There is also a Random role that randomly selects one of the nine classes and a subclass, the Demoknight, which drastically changes the way a class is played.