Original by Philip Gibbs 1997.
The short answer is "no", but it is a qualified "no" because there are odd ways of interpreting the question which could justify the answer "yes".
Light is composed of photons so we could ask if the photon has mass. The answer is then definitely "no": The photon is a massless particle. According to theory it has energy and momentum but no mass and this is confirmed by experiment to within strict limits. Even before it was known that light is composed of photons it was known that light carries momentum and will exert a pressure on a surface. This is not evidence that it has mass since momentum can exist without mass. [ For details see the Physics FAQ article What is the mass of the photon?].
Sometimes people like to say that the photon does have mass because a photon has energy E = hf where h is Planck's constant and f is the frequency of the photon. Energy, they say, is equivalent to mass according to Einstein's famous formula E = mc2. They also say that a photon has momentum and momentum is related to mass p = mv. What they are talking about is "relativistic mass", an outdated concept which is best avoided [ See Relativity FAQ article Does mass change with velocity? ] Relativistic mass is a measure of the energy E of a particle which changes with velocity. By convention relativistic mass is not usually called the mass of a particle in contemporary physics so it is wrong to say the photon has mass in this way. But you can say that the photon has relativistic mass if you really want to. In modern terminology the mass of an object is its invariant mass which is zero for a photon.
If we now return to the question "Does light have mass?" this can be taken to mean different things if the light is moving freely or trapped in a container. The definition of the invariant mass of an object is m = sqrt{E2/c4 - p2/c2}. By this definition a beam of light, is massless like the photons it is composed of. However, if light is trapped in a box with perfect mirrors so the photons are continually reflected back and forth in the box, then the total momentum is zero in the boxes frame of reference but the energy is not. Therefore the light adds a small contribution to the mass of the box. This could be measured - in principle at least - either by an increase in inertia when the box is slowly accelerated or by an increase in its gravitational pull. You might say that the light in the box has mass but it would be more correct to say that the light contributes to the total mass of the box of light. You should not use this to justify the statement that light has mass in general.
It might be thought that it would be better to regard the relativistic mass as the actual mass of photons and light, instead of invariant mass. We could then consistently talk about the light having mass independently of whether or not it is contained. If relativistic mass is used for all objects then mass is conserved and the mass of an object is the sum of the masses of its part. However, modern usage defines mass as the invariant mass of an object mainly because the invariant mass is more useful when doing any kind of calculation. In this case mass is not conserved and the mass of an object is not the sum of the masses of its parts. For example the mass of a box of light is more than the mass of the box and the sum of the masses of the photons (the latter being zero). Relativistic mass is equivalent to energy so it is a redundant concept. In the modern view mass is not equivalent to energy. It is just that part of the energy of a body which is not kinetic energy. Mass is independent of velocity whereas energy is not.
Let's try to phrase this another way. What is the meaning of the equation E=mc2? You can interpret it to mean that energy is the same thing as mass except for a conversion factor equal to the square of the speed of light. Then wherever there is mass there is energy and wherever there is energy there is mass. In that case photons have mass but we call it relativistic mass. Another way to use Einstein's equation would be to keep mass and energy as separate and use it as an equation which applies when mass is converted in energy or energy is converted to mass as in nuclear reactions. The mass is then independent of velocity and is closer to the old Newtonian concept. In that case only total of energy and mass would be conserved but it seems better to try to keep conservation of energy. The interpretation most widely used is a compromise in which mass is invariant and always has energy so that total energy is conserved but kinetic energy and radiation does not have mass. The distinction is purely a matter of semantic convention.
Sometimes people ask "If light has no mass how can it be deflected by the gravity of a star?" One answer is that any particles such as photons of light, move along geodesics in general relativity and the path they follow is independent of their mass. The deflection of star-light by the sun was first measured by Arthur Eddington in 1919. The result was consistent with the predictions of general relativity and inconsistent with the Newtonian theory. Another answer is that the light has energy and momentum which couples to gravity. The energy-momentum 4-vector of a particle, rather than its mass, is the gravitational analogue of electric charge. The corresponding analogue of electric current is the energy-momentum stress tensor which appears in the gravitational field equations of general relativity. 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. The energy and momentum of light also generates curvature of space-time so according to theory it can attract objects gravitationally. This effect is far too weak to have been measured. The gravitational effect of photons does not have any cosmological effects either (except perhaps in the first instant after the big bang). There are far too few with too little energy to make up any noticeable proportion of dark matter.