  The performance is presented of the reconstruction and identification
algorithms for electrons and photons with the CMS experiment at the LHC. The
reported results are based on proton-proton collision data collected at a
center-of-mass energy of 13 TeV and recorded in 2016-2018, corresponding to an
integrated luminosity of 136 fb$^{-1}$. Results obtained from lead-lead
collision data collected at $\sqrt{s_\mathrm{NN}}=$ 5.02 TeV are also
presented. Innovative techniques are used to reconstruct the electron and
photon signals in the detector and to optimize the energy resolution. Events
with electrons and photons in the final state are used to measure the energy
resolution and energy scale uncertainty in the recorded events. The measured
energy resolution for electrons produced in Z boson decays in proton-proton
collision data ranges from 2 to 5%, depending on electron pseudorapidity and
energy loss through bremsstrahlung in the detector material. The energy scale
in the same range of energies is measured with an uncertainty smaller than 0.1
(0.3)% in the barrel (endcap) region in proton-proton collisions and better
than 1 (3)% in the barrel (endcap) region in heavy ion collisions. The timing
resolution for electrons from Z boson decays with the full 2016-2018
proton-proton collision data set is measured to be 200 ps.
