When Googling for lens flare, one often finds images that also include stars (rays / diffraction spikes), like this:
What is the difference between diffraction spikes and lens flare and are the two terms interchangeable?
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It only takes a minute to sign up.
Sign up to join this communityDiffraction spikes are caused by diffraction at the edge of the aperture. The number of spikes relates to the number of blades and the intensity of the effect relates to the exact shape of the blades and how closed down the aperture is.
On the other hand, lens flare is reflections within the lens itself. Visible as a clear rendition of the internals of the lens assembly ("ghosting") and sometimes as a general haze over the image ("veiling glare"). The effect is related to the angle of incidence (lack of lens hood) and the complexity of the elements (e.g. more elements in a zoom vs. prime).
Nicely illustrated in your image, both can occur at once of course, but for independent reasons (and technically independent terminology).
Diffraction
Diffraction causes light to spread out, when moving through the aperture of a lens, perpendicular to the straight edges of that aperture. This causes the spikes that bleed out from point light sources.
The number of spikes is directly related to the number of straight edges available in the aperture. Each edge produces a spike, but due to the symmetry of even-number bladed apertures, these spikes overlap. So, if the aperture has an even number of blades, then the number diffraction of spikes appear to be equal to that number of blades, while with odd-number designs, the number of spikes is two times the blade count.
The length of the spikes is directly related to the aperture used. As can be seen above in the last example, a perfectly circular aperture does not produce any clear spikes. At large f-stops (such as f/2.8), the aperture approaches a more perfect circle and the spikes may not exist or may be too small to see in comparison to the point light source.
In order to elongate them, smaller apertures must be used. The smaller the aperture, the longer the spikes.
Flare
Flare is caused by light reflecting off of the internal surfaces or elements within the lens. It can manifest as visible artifacts within the captured photo or as a contrast-robbing haze across all or part of the image.
Flare is caused by very bright light sources coming in from a shallow angle to the lens:
My own experience has led me to conclude that haze is most often seen when the light source is just out of the frame with its light coming across the lens, while visual artifacts can be exacerbated by getting the light source within the frame but still coming in at an angle (use of wide angle lenses helps here, if you're trying to go for artifacts. So too does using older/cheaper lenses that lack decent anti-reflective coating).
If trying to reduce flare, the best thing to do is cast a shadow over the lens and block the light coming from the light source. This can be done with a lens hood, a scrim, a sheet, your hand - really just about anything.
What is the difference between diffraction spikes and lens flare and are the two terms interchangeable?
As can be seen above, the two are different phenomena that can be photographed together or separately, pending circumstances and goals. The terms should not be used interchangeably.