We consider a non-atomic congestion game on a graph, with several classes of players. Each player wants to go from his origin vertex to his destination vertex at the minimum cost and all players of a given class share the same characteristics: cost functions on each arc, and origin–destination pair. Under some mild conditions, it is known that a Nash equilibrium exists, but the computation of such an equilibrium in the multiclass case is an open problem for general functions. We consider the specific case where the cost functions are affine. We show that this problem is polynomially solvable when the number of vertices and the number of classes are fixed. In particular, it shows that the parallel two-terminal case with a fixed number of classes is polynomially solvable. On a more practical side, we propose an extension of Lemke’s algorithm able to solve this problem.