Why don't absorption and emission lines cancel out in our Sun?

I think that this is a very good question.

In my answer I will only mention the formation of one of the absorption lines, the 589 nm of sodium, and I will call the photon associated with that wavelength a "sodium photon".
What I will try to explain with reference to that particular wavelength of light will be true for all the other wavelengths for which absorption occurs.

The schismatic layout of a standard demonstration of absorption and emission lines is shown below.

enter image description here

At position $A$ one would see an absorption spectrum and at position $B$ an emission spectrum and the "re-radiated in all directions" explanation works very well.

The difference with the Sun is that the "sodium flame" envelopes the Sun and the rate of "sodium photons" emerging from the Sun is less than the rate of emergence of photons with comparable wavelengths.

I think that the OP is asking "Where do the re-radiated sodium photons go?"

The fact is that the rate at which sodium photons escape from the "sodium flame blanket" around the Sun (the Sun's outer layers) is smaller than the rate at which photons close in wavelength escape.

So in effect that outer layer of the Sun is fairly opaque to sodium photons.

As the sodium photons which are being produced in the internal layers of the Sun progress through the outer layers of the Sun they get absorbed and re-radiated so the net rate in the forward (away from the Sun) direction decreases and there is a flux of sodium photons heading back towards the Sun.
Here they interact with the hotter "inner" layers of the Sun and do not necessarily emerge again as sodium photons, their wavelength is changed.
They are thermalised (I cannot think of a better wording).
Those sodium photons enter regions within the Sun where they they are in excess of what might expect for the distribution of wavelength for the temperature of those inner layers.
Interactions within those layers reduce that excess number of sodium photons, so they cease to be sodium photons.

So the net effect is that the "sodium flame blanket" around the Sun sends back towards the Sun sodium photons which are then transformed into photons of other wavelengths.



The photons we see from the Sun, were those that were able to escape from its photosphere - an outer layer only a few hundred km in thickness.

The interior of the Sun is hotter than layers further out and the radiation field approximates to a blackbody, with a radiation flux that is strongly temperature dependent. The strong temperature dependence, combined with the negative temperature gradient means that the solar spectrum is produced by the hottest layers we can see.

Why the emphasis? Well, the depth we can see into the Sun is wavelength dependent. Where there are strong radiative transition probabilities, the light coming from the interior is absorbed. The re-emitted light (it has to be re-emitted if the material is in thermal equilibrium) is emitted in a random direction and a negligible fraction comes towards us.

I think there are two key points. One is the random direction of the re-emission of absorbed energy, but the other is the temperature gradient which means there is a clear outward directionality to the net radiative flux which means you can treat the Sun as a succession of cooler "slabs" as one moves outward.

The net effects are absorption lines. A good way to think about the solar spectrum is that at each wavelength you are seeing a (roughly) blackbody spectrum emitted at the temperature of the layer from which photons at that wavelength can escape. Thus the bottom of an absorption line is emitted at cooler temperatures, closer to the "surface", whilst continuum comes from hotter, deeper layers, but at wavelengths where the opacity is lower so that the photons are still able to make it out.


The internal photons of the sun take enormous time to reach the surface, and certainly any spectral lines are lost.

The spectral lines observed from the sun come from an outer layer of the sun's atmosphere.

The top of the photosphere is significantly cooler, with a temperature of only 4400 Kelvin; thus, the cooler, low-density gas at the top of the photosphere produces absorption lines in the solar spectrum.

Because it is low density, the photons as observed from the earth come in a straight line to our detectors, while the ones with the correct frequencies to be absorbed create the absorption lines. The deexcitation photons have a reduced intensity because of the 4pi distribution, and a low probability to excite another atom because of the low density. Thus those frequencies are depleted and show up as absorption lines.