Your location when observing a star and the Earth’s position in its orbit affect your view of the star’s surroundings and its location in the sky. The change in perspective is known as parallax, which you measure as the angle between the Earth's position now, the star, and Earth's position three months earlier or later. Being an angle, it has units in degrees of arc. Since parallax measurements can end up being a small fraction of a degree, you usually use seconds of arc (one 3,600th of a degree), also known as arcseconds. You need this value in order to figure out the distance to the star, which is expressed in parsecs, derived from “parallax of one arcsecond.”
TL;DR (Too Long; Didn't Read)
To calculate the distance to a star in parsecs, divide 1 by the arcseconds of parallax. To calculate with milliarcseconds, first divide the number by 1,000, then divide 1 by the result.
Optional: Convert Milliarcseconds to Arcseconds
Convert to arcseconds if necessary. Some stars are so far away that their arcsecond values may be written as milliarcseconds. As with other metric conversions, all you have to do is divide by 1,000. For example, 3 milliarcseconds equals 0.003 arcseconds.
Take Reciprocal of Arcseconds
Divide 1 by the number of arcseconds to get the number of parsecs. Don’t be surprised if you find yourself working with numbers smaller than zero; Proxima Centauri, the nearest star to our solar system, has a parallax of 0.77 arcseconds. This would give you less than 1.3 parsecs. The values only get smaller as you look at stars that are farther away.
Calculate Star Magnitude
Use the parsec value you calculated in the step above to find either the apparent or absolute magnitude of stars if you already know one of the magnitudes. Remember the apparent magnitude minus the absolute magnitude equals -5 + (5 × log(d)), where (d) is the distance in parsecs and the log is a logarithm base 10 -- use the LOG key on your calculator.