In railroad structures, and railroad terminology, a wye (like the 'Y' glyph) or triangular junction is a triangular joining arrangement of three rail lines with a railroad switch (set of points) at each corner connecting to each incoming line. A turning wye is a specific case.
Where two rail lines join, or in a joint between a railroad's mainline and a spur, wyes can be used as a mainline rail junction to allow incoming consists ability to travel either direction, or in order to allow trains to pass from one line to the other line.
Wyes can also be used for turning railway equipment, and generally cover less area than a balloon loop doing the same job but at the cost of two additional sets of points to construct, then maintain. These turnings are accomplished by performing the railway equivalent of a three-point turn through successive junctions of the wye, the direction of travel and the relative orientation of a locomotive or railway vehicle can be reversed, resulting in it facing in the direction from which it came. When and where a wye is built specifically for equipment reversing purposes, one or more of the tracks making up the junction will typically be a stub siding. In materials and annual taxes, the cost of two junctions is offset by saved capital investment and yearly taxes.
Tram or streetcar tracks also make use of triangular junctions and sometimes have a short triangle or wye stubs to turn the car at the end of the line.
The use of triangular junctions allows flexibility in routing trains from any line to any other line, without the need to reverse the train. For this reason they are common across most rail networks. Slower bi-directional trains may enter a wye, letting a faster one pass, and continue on the same direction providing service to nearby freight transport or a passenger station.
Where one or more of the lines meeting at the junction are multi-track, the presence of a triangular junction does introduce a number of potential conflicting moves. For this reason, where traffic is heavy, the junction may incorporate flying junctions on some, or all, or the legs of the triangle.