A massless particle can have energy E and momentum p because mass is related to these by the equation m2 = E2/c4 - p2/c2, which is zero for a photon because E = pc for massless radiation.
Can a massless object have energy?
If a particle has no mass (m = 0) and is at rest (p = 0), then the total energy is zero (E = 0). But an object with zero energy and zero mass is nothing at all. ... But light is not the only massless object. Gluons and the hypothetical gravitons are also massless, and therefore travel at speed c in all frames.
Does energy have mass?
Energy does not have a mass. But mass is a form of energy. Rest mass of a particle is one form of energy. ... Relativistic mass of a particle is another form of energy which happens to be the kinetic energy of the particle.