If you wanted to pay a visit to the red planet, how long would it take? The answer depends on a number of things, ranging from the position of the planets to the technology that would propel you there. Let's examine a few of the most important points.

To determine how long it will take to reach Mars, we must first know the distance between the two planets.

Mars is the fourth planet from the sun, and the second closest to Earth (Venus is the closest). But the distance between the two planets is constantly changing as they travel around the sun.

In theory, the closest that Earth and Mars would approach each other would be when Mars is at its closest point to the sun (perihelion) and Earth is at its farthest (aphelion). This would put the planets only 33.9 million miles (54.6 million kilometers) apart. However, this has never happened in recorded history. The closest recorded approach of the two planets occurred in 2003, when they were only 34.8 million miles (56 million km) apart.

The two planets are farthest apart when they are both at their farthest from the sun, on opposite sides of the star. At this point, they can be 250 million miles (401 million km) apart.

The average distance between the two planets is 140 million miles (225 million km).

Light travels at approximately 186,282 miles per second (299,792 km per second). Therefore, a light shining from the surface of Mars would take the following amount of time to reach Earth (or vice versa):

• Closest possible approach: 182 seconds, or 3.03 minutes
• Closest recorded approach: 187 seconds, or 3.11 minutes
• Farthest approach: 1,342 seconds, or 22.4 minutes
• On average: 751 seconds, or just over 12.5 minutes

The fastest spacecraft launched from Earth was NASA's New Horizons mission, which visited Pluto in 2015. In January 2006, the probe left Earth at 36,000 mph (58,000 kph). If such a probe traveled in a straight line to Mars, the time it would take to get to Mars would be:

• Closest possible approach: 942 hours (39 days)
• Closest recorded approach: 967 hours (41 days)
• Farthest approach: 6,944 hours (289 days)
• On average: 3,888 hours (162 days)

No planet is more steeped in myth and misconception than Mars. This quiz will reveal how much you really know about some of the goofiest claims about the red planet.
0 of 10 questions complete
Mars Myths & Misconceptions: Quiz
No planet is more steeped in myth and misconception than Mars. This quiz will reveal how much you really know about some of the goofiest claims about the red planet.
0 of questions complete

Of course, the problem with the previous calculations is that they measure distance between the two planets as a straight line. Traveling through the farthest passing of Earth and Mars would involve a trip directly through the sun, while spacecraft must of necessity move in orbit around the solar system's star.

Although this isn't a problem for the closest approach, when the planets are on the same side of the sun, another problem exists. The numbers also assume that the two planets remain at a constant distance; that is, when a probe is launched from Earth while the two planets are at the closest approach, Mars would remain the same distance away over the course of the 39 days it took the probe to travel. [Countdown: The Boldest Mars Missions in History]

In reality, however, the planets are continuously moving in their orbits around the sun. Engineers must calculate the ideal orbits for sending a spacecraft from Earth to Mars. Their numbers factor in not only distance but also fuel efficiency. Like throwing a dart at a moving target, they must calculate where the planet will be when the spacecraft arrives, not where it is when it leaves Earth. Spaceships must also decelerate to enter orbit around a new planet to avoid overshooting it.

How long it takes to reach Mars depends on where in their orbits the two planets lie when a mission is launched. It also depends on the technological developments of propulsion systems.

According to NASA Goddard Space Flight Center's website, the ideal lineup for a launch to Mars would get you to the planet in roughly nine months. The website quotes physics professor Craig C. Patten, of the University of California, San Diego:

"It takes the Earth one year to orbit the sun and it takes Mars about 1.9 years (say 2 years for easy calculation) to orbit the sun. The elliptical orbit which carries you from Earth to Mars is longer than Earth's orbit, but shorter than Mars' orbit. Accordingly, we can estimate the time it would take to complete this orbit by averaging the lengths of Earth's orbit and Mars' orbit. Therefore, it would take about one and a half years to complete the elliptical orbit.

"In the nine months it takes to get to Mars, Mars moves a considerable distance around in its orbit, about three-eighths of the way around the sun. You have to plan ahead to make sure that by the time you reach the distance of Mar's orbit, that Mars is where you need it to be! Practically, this means that you can only begin your trip when Earth and Mars are properly lined up. This only happens every 26 months. That is, there is only one launch window every 26 months."

The trip could be shortened by burning more fuel — a process not ideal with today's technology, Patten said.

Evolving technology can help to shorten the flight. NASA's Space Launch System (SLS) will be the new workhorse for carrying upcoming missions, and potentially humans, to the red planet. SLS is currently being constructed and tested, with its first flight planned for 2019.

Robotic spacecraft could one day make the trip in only three days. Photon propulsion would rely on a powerful laser to accelerate spacecraft to velocities approaching the speed of light. Philip Lubin, a physics professor at the University of California, Santa Barbara, and his team are working on the Directed Energy Propulsion for Intersteller Exploration (DEEP-IN). The method could propel a 220-lb. (100 kilogram) robotic spacecraft to Mars in only three days, he said.

"There are recent advances which take this from science fiction to science reality," Lubin said at the 2015 NASA Innovative Advanced Concepts (NIAC) fall symposium. "There's no known reason why we cannot do this."

Here is a list of how long it took several historical missions to reach the red planet. Their launch dates are included for perspective.

• Mariner 4, the first spacecraft to go to Mars (1965 flyby): 228 days
• Mariner 6 (1969 flyby): 155 days
• Mariner 7 (1969 flyby): 128 days
• Mariner 9, the first spacecraft to orbit Mars (1971): 168 days
• Viking 1, the first U.S. craft to land on Mars (1975): 304 days
• Viking 2 Orbiter/Lander (1975): 333 days
• Mars Global Surveyor (1996): 308 days
• Mars Pathfinder (1996): 212 days
• Mars Odyssey (2001): 200 days
• Mars Express Orbiter (2003): 201 days
• Mars Reconnaissance Orbiter (2005): 210 days
• Mars Science Laboratory (2011): 254 days

Editor's note: This article was updated to correct the date of Mariner 4's flyby.