  We present the compilation of the Fifth Catalogue of Nearby Stars (CNS5),
based on astrometric and photometric data from Gaia EDR3 and Hipparcos, and
supplemented with parallaxes from ground-based astrometric surveys carried out
in the infrared.
  The aim of the CNS5 is to provide the most complete sample of objects in the
solar neighbourhood. For all known stars and brown dwarfs in the 25 pc sphere
around the Sun, basic astrometric and photometric parameters are given.
Furthermore, we provide the colour-magnitude diagram and various luminosity
functions of the stellar content in the solar neighbourhood, and characterise
the completeness of the CNS5 catalogue.
  We compile a sample of stars and brown dwarfs which most likely are located
within 25 pc of the Sun, taking space-based parallaxes from Gaia EDR3 and
Hipparcos as well as ground-based parallaxes from Best et al. (2021),
Kirkpatrick et al. (2021), and from the CNS4 into account. We develop a set of
selection criteria to clean the sample from spurious sources. Furthermore, we
show that effects of blending in the Gaia photometry, which affect mainly the
faint and red sources in Gaia, can be mitigated, to reliably place those
objects in a colour-magnitude diagram. We also assess the completeness of the
CNS5 using a Kolmogorov-Smirnov test and derive observational optical and
mid-infrared luminosity functions for the main-sequence stars and white dwarfs
in the solar neighbourhood. The CNS5 contains 5931 objects, including 5230
stars (4946 main-sequence stars, 20 red giants and 264 white dwarfs) and 701
brown dwarfs.
  We find that the CNS5 catalogue is statistically complete down to 19.7 mag in
G-band and 11.8 mag in W1-band absolute magnitudes, corresponding to a spectral
type of L8.
