The Andromeda Galaxy , also known as Messier 31 , M31 , or NGC 224 and originally the Andromeda Nebula (see below), is a Barred spiral galaxy approximately 2.5 million light-years (770 Kiloparsecs ) from Earth and the nearest large galaxy to the Milky way . The galaxy's name stems from the area of Earth's sky in which it appears, the Constellation of Andromeda , which itself is named after the Ethiopian (or Phoenicia) who was the wife of Perseus in Greek mythology . The virial masses of the Andromeda Galaxy is of the same order of magnitude as that of the Milky Way, at 1 trillion solar masses (2.0 × 10 42 kilograms). The mass of either galaxy is difficult to estimate with any accuracy, but it was long thought that the Andromeda Galaxy is more massive than the Milky Way by a margin of some 25% to 50%. This has been called...