In railroad structures and rail terminology, a wye (like the 'Y' glyph) or triangular junction (often shortened to just triangle) is a triangular joining arrangement of three rail lines with a railroad switch (set of points) at each corner connecting to the incoming lines. A turning wye is a specific case.
Where two rail lines join, or where a spur diverges from a railroad's mainline, wyes can be used at a mainline rail junction to allow incoming trains to travel in either direction.
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 and 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 thus can be reversed. 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.
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.