You're correct that photons have energy and momentum, but they do not have mass. This is a fundamental concept in physics.
In the theory of special relativity, developed by Albert Einstein, the relationship between energy (E), momentum (p), and mass (m) is given by the equation:
E^2 = (pc)^2 + (mc^2)^2
Here, c represents the speed of light. For particles with mass (m > 0), the equation simplifies to the famous E = mc^2, which relates energy and mass. However, for particles with zero rest mass, such as photons, the mass term (mc^2) becomes zero:
E^2 = (pc)^2
This equation shows that energy (E) is directly proportional to momentum (p) for massless particles. Photons are massless particles, meaning they have no rest mass. They travel at the speed of light in a vacuum (c), and all of their energy is associated with their momentum.
Photons do possess energy and momentum due to their oscillating electric and magnetic fields. The energy of a photon is given by E = hf, where h is Planck's constant and f is the frequency of the photon. The momentum of a photon is given by p = hf/c, where c is the speed of light.
So, while photons carry energy and momentum, they do not have mass. This is one of the unique characteristics of photons and is a consequence of the theory of special relativity.