The distance between the Earth and Mars varies depending on the orbits of both planets. Travelling at the speed of light, it would take only 182 seconds when both planets are at their closest or 1,342 seconds when at their furthest.
The closest possible distance between the Earth and Mars is 54.6 million kilometers. The furthest possible distance between both planets is 401 million kilometers. The speed of light is 299,792 kilometers per second. By comparison, NASA's New Horizons probe, which travelled 58,000 kilometers per hour, would take 942 hours to reach Mars if it left at the closest possible distance between both planets.