The physics motivation, detector design, triggers, calibration, alignment, simulation, and overall performance of the very forward CASTOR calorimeter of the CMS experiment are reviewed. The CASTOR Cherenkov sampling calorimeter is located very close to the LHC beam line, at a radial distance of about 1cm from the beam pipe, and at 14.4m from the CMS interaction point, covering the pseudorapidity range of −6.6 < η < −5.2. It was designed to withstand high ambient radiation and strong magnetic fields. The performance of the detector in measurements of forward energy density, jets, and processes characterized by rapidity gaps, is reviewed using data collected in proton and nuclear collisions at the LHC.