If you were to remove Earth’s atmosphere and assuming that space is a perfect vacuum, which it is definitely not, and there were no obstruction to absorb the photons, then yes, it would continue to infinity. However, due to the inverse square law, the light would spread out over the vast distance to the point where it wouldn’t be detectable in a meaningful way. The individual photons coming from your laser would still continue though until something stopped it.
Latest Answers