Dirichlet-to-Neumann (DtN) boundary conditions for unbounded wave guides in two and three dimensions are derived and analyzed, defining problems that are suitable for finite element analysis. In the most general cases considered wave numbers may vary in arbitrary cross sections. The full DtN operator, in the form of an infinite series, is exact. Nonunique solutions may occur when this operator is truncated. Simple criteria for the number of terms in the truncated operator that guarantee unique solutions are presented. A simple modification of the truncated operator leads to uniqueness for any number of terms. Numerical results validate the performance of DtN formulations for wave guides and confirm the criteria for uniqueness.