  We review the role of stellar flybys and encounters in shaping planet-forming
discs around young stars, based on the published literature on this topic in
the last 30 years. Since most stars $\leq~2$ Myr old harbour protoplanetary
discs, tidal perturbations affect planet formation. First, we examine the
probability of experiencing flybys or encounters: More than 50\% of stars with
planet-forming discs in a typical star forming environment should experience a
close stellar encounter or flyby within 1000 au. Second, we detail the
dynamical effects of flybys on planet-forming discs. Prograde, parabolic,
disc-penetrating flybys are the most destructive. Grazing and penetrating
flybys in particular lead to the capture of disc material by the secondary to
form a highly misaligned circumsecondary disc with respect to the disc around
the primary. One or both discs may undergo extreme accretion and outburst
events, similar to the ones observed in FU Orionis-type stars. Warps and broken
discs are distinct signatures of retrograde flybys. Third, we review some
recently observed stellar systems with discs where a stellar flyby or an
encounter is suspected -- including UX Tau, RW Aur, AS 205, Z CMa, and FU Ori.
Finally, we discuss the implications of stellar flybys for planet formation and
exoplanet demographics, including possible imprints of a flyby in the Solar
System in the orbits of trans-Neptunian objects and the Sun's obliquity.
