Sunlight is produced through nuclear reactions in the sun's core. Originally born as energetic gamma rays, after billions of collisions with matter, this radiation reaches the surface and escapes into space. How old is sunlight by the time it reaches the surface?
Most textbooks say that it takes light between 100,000 years and 50 million years to escape. You would be surprised to know that this simple, and very popular, question seems to be without a firm answer! The reason has a lot to do with the assumptions that textbook authors use in making the calculation. Most astronomers are also not particularly interested in a high-accuracy answer, so they tend not to bother doing the tedious calculation exactly. It is actually a very complex problem in physics!
Once a photon of light is born, it travels at a speed of 300,000 km/sec until it collides with a charged particle and is diverted in another direction. Because the density of the sun decreases by tens of thousands of times from its lead-dense core to its tenuous photosphere, the typical distance a photon can travel between charged particles changes from 0.01 cm at the core to 0.3 cm near the surface. As a comparison, most back-of-the-envelope estimates assume that the sun's interior has a constant density and that the 'free path' distance for the photon is about one centimeter. It is these estimates that find their way into many popular astronomy textbooks.