Abstract The near infrared background (NIRB) is the collective light from unresolved sources observed in the band 1–10 $\rm{\mu m}$. The measured NIRB angular power spectrum on angular scales θ ≳ 1 arcmin exceeds by roughly two order of magnitudes predictions from known galaxy populations. The nature of the sources producing these fluctuations is still unknown. Here we test primordial black holes (PBHs) as sources of the NIRB excess. Considering PBHs as a cold dark matter (DM) component, we model the emission of gas accreting onto PBHs in a cosmological framework. We account for both accretion in the intergalactic medium (IGM) and in DM haloes. We self consistently derive the IGM temperature evolution, considering ionization and heating due to X-ray emission from PBHs. Besides ΛCDM, we consider a model that accounts for the modification of the linear matter power spectrum due to the presence of PBHs; we also explore two PBH mass distributions, i.e. a δ-function and a lognormal distribution. For each model, we compute the mean intensity and the angular power spectrum of the NIRB produced by PBHs with mass 1–$10^3~\rm M_{\odot}$. In the limiting case in which the entirety of DM is made of PBHs, the PBH emission contributes <1 per cent to the observed NIRB fluctuations. This value decreases to <0.1 per cent if current constraints on the abundance of PBHs are taken into account. We conclude that PBHs are ruled out as substantial contributors to the NIRB.