We have used density functional theory and the SIESTA code to investigate the electronic bandgap and optical spectra of zigzag boron nitride nanoribbons n-ZBNNRs (n = 18, 22, 26, 30). The electronic structure of the simulated nanoribbons reveals that they are semiconductors with a bandgap of 4.87–4.95 eV. For energies greater than 5 eV, the real part of the dielectric function suggests that ZBNNRs are negative refractive index materials. n-ZBNNRs also have a lower static refractive index than armchair graphene nanoribbons. The fundamental reason is that the boron nitride nanoribbons have more localized electrons. The optical absorption of n-ZBNNRs (n = 18, 22, 26, 30) is anisotropic for the x, y, and z polarizations as well. Moreover, Eoptical gap18-BNNRs = 4.95 eV, Eoptical gap22-BNNRs = 4.94 eV, Eoptical gap26-BNNRs = 4.92 eV, and E optical gap30-BNNRs = 4.87 eV. The maximum optical extinction occurs at E ≈ 6–7 eV for the y polarization and E ≈ 5–6 eV for the z-direction. Besides, by around 6 eV for the y polarization (and 5 eV for the z polarization), σ is almost 1500 Ω−1 cm−1 (and 860–1500 Ω−1 cm−1). The imaginary part of the optical conductivity indicates that for the low energy range, n-ZBNNRs (n = 18, 22, 26, 30) supply the conditions of the transverse-electric mode existence. In addition, for $$E_{y} \, > \,6$$ eV and $$E_{x} \, > \,5$$ , n-ZBNNRs (n = 18, 22, 26, 30) support the transverse-magnetic plasmons.