The energy carried by a particular photon is measured by the length of its wave, or wavelength.
Visible light represents only a small part of the electromagnetic spectrum, between wavelengths of about 400 and 740 nanometers.
The shorter the wavelength, the greater its energy.